# File lib/hammer_cli_import/base.rb, line 373
    def create_entity(entity_type, entity_hash, original_id, recover = nil, retries = 2)
      raise ImportRecoveryError, "Creation of #{entity_type} not recovered by " \
        "'#{recover || option_recover.to_sym}' strategy" if retries < 0
      uniq = nil
      begin
        return _create_entity(entity_type, entity_hash, original_id)
      rescue RestClient::UnprocessableEntity => ue
        error " Creation of #{to_singular(entity_type)} failed."
        uniq = nil
        err = JSON.parse(ue.response)
        err = err['error'] if err.key?('error')
        if found_errors(err)
          uniq = process_error(err, entity_hash)
        end
        raise ue unless uniq
      end

      uniq = uniq.to_sym

      case recover || option_recover.to_sym
      when :rename
        entity_hash[uniq] = original_id.to_s + '-' + entity_hash[uniq]
        info " Recovering by renaming to: \"#{uniq}\"=\"#{entity_hash[uniq]}\""
        return create_entity(entity_type, entity_hash, original_id, recover, retries - 1)
      when :map
        entity = lookup_entity_in_cache(entity_type, {uniq.to_s => entity_hash[uniq]})
        if entity
          info " Recovering by remapping to: #{entity['id']}"
          return map_entity(entity_type, original_id, entity['id'])
        else
          warn "Creation of #{entity_type} not recovered by \'#{recover}\' strategy."
          raise ImportRecoveryError, "Creation of #{entity_type} not recovered by \'#{recover}\' strategy."
        end
      else
        fatal 'No recover strategy.'
        raise ue
      end
      nil
    end