public static DbGetGeoFilterRequest ToDbGetGeoFilterRequest
     (this _TEntity from, int defaultLimit, int maxLimit)
 => from is null
         ? null
         : new DbGetGeoFilterRequest
 {
     Offset = Math.Max(0, from.Offset),
     Limit  = from.Limit <= 0
                 ? defaultLimit
                 : Math.Min(from.Limit, maxLimit),
     Archived     = from.Archived,
     ProjectId    = from.ProjectId,
     Contains     = from.СontainsKeyWords,
     DistanceLat  = from.DistanceLat,
     DistanceLong = from.DistanceLong,
     CenterLat    = from.CenterLat,
     CenterLong   = from.CenterLong
 };
 public static Dictionary <string, object> ToDictionary
     (this _TEntity from)
 => from is null
         ? null
         : new Dictionary <string, object>
 {
     { nameof(from.Archived), from.Archived },
     { nameof(from.Limit), from.Limit },
     { nameof(from.Offset), from.Offset },
     { nameof(from.ProjectId), from.ProjectId },
     { nameof(from.DistanceLat), from.DistanceLat },
     { nameof(from.DistanceLong), from.DistanceLong },
     { nameof(from.CenterLat), from.CenterLat },
     { nameof(from.CenterLong), from.CenterLong },
     { nameof(from.СontainsKeyWords), from.СontainsKeyWords },
     { nameof(from.CurrentPrincipal),
       String.Join(',',
                   from.CurrentPrincipal
                   .ToDictionary()
                   .Select(x => $"{x.Key}={x.Value}")) },
 };
        public async Task <ListResponse <_TEntity> > Handle(_TListQuery request,
                                                            CancellationToken cancellationToken)
        {
            Logger.LogInformation(AppLogEvent.HandleRequest,
                                  "Handle Get Geo List {Request}", request.ToDictionary());

            if (request is null)
            {
                Logger.LogWarning(AppLogEvent.HandleArgumentError,
                                  "Handle Get Geo List request with empty request");
                return(ErrorResponse("Request empty argument"));
            }

            try
            {
                // Validate request
                var validator        = new ListQueryValidator <_TListQuery>();
                var validationResult = await validator.ValidateAsync(request)
                                       .ConfigureAwait(false);

                if (!validationResult.IsValid)
                {
                    Logger.LogError("Query validation error. " +
                                    "Request={Request}. Error={Error}.",
                                    request.ToDictionary(),
                                    validationResult.Errors.Select(x => x.ErrorMessage));
                    return(ErrorResponse
                               (validationResult.Errors.Select(x => x.ErrorMessage)));
                }

                // Build request
                var defaultLimit = Configuration.GetValue
                                       (Defaults.ConfigurationApiDefaultLimitParameterName,
                                       Defaults.ConfigurationApiDefaultLimitDefaultValue);
                var maxLimit = Configuration.GetValue
                                   (Defaults.ConfigurationApiMaxLimitParameterName,
                                   Defaults.ConfigurationApiMaxLimitDefaultValue);

                var dbGeoListRequest = request
                                       .ToDbGetGeoFilterRequest(defaultLimit, maxLimit);

                // Check current actor
                var currentActorResponse = await Mediator
                                           .Send(new DbGetActorByNameRequest
                                                 (request.CurrentPrincipal?.Identity?.Name))
                                           .ConfigureAwait(false);

                if (!currentActorResponse.Success ||
                    currentActorResponse.Entity.IsArchived)
                {
                    Logger.LogWarning(AppLogEvent.HandleArgumentError,
                                      "Not found current actor");
                    return(ErrorResponse("Not found current actor"));
                }

                return(await Mediator
                       .Send(dbGeoListRequest)
                       .ConfigureAwait(false));
            }
            catch (Exception e)
            {
                Logger.LogError(AppLogEvent.HandleErrorResponse, e,
                                "Call repository exception");
                return(ErrorResponse("Not found"));
            }
        }