public async Task <PagedQueryResult <CustomEntitySummary> > ExecuteAsync(SearchCustomEntitySummariesQuery query, IExecutionContext executionContext)
        {
            var definition = _customEntityDefinitionRepository.GetByCode(query.CustomEntityDefinitionCode);

            EntityNotFoundException.ThrowIfNull(definition, query.CustomEntityDefinitionCode);

            // Get Main Query
            var dbPagedResult = await RunQueryAsync(query, definition, executionContext);

            var mappedResult = await _customEntitySummaryMapper.MapAsync(dbPagedResult.Items, executionContext);

            return(dbPagedResult.ChangeType(mappedResult));
        }
        public async Task <IDictionary <int, CustomEntitySummary> > ExecuteAsync(GetCustomEntitySummariesByIdRangeQuery query, IExecutionContext executionContext)
        {
            var dbResults = await QueryAsync(query, executionContext);

            // Validation permissions
            var definitionCodes = dbResults.Select(r => r.CustomEntity.CustomEntityDefinitionCode);

            _permissionValidationService.EnforceCustomEntityPermission <CustomEntityReadPermission>(definitionCodes, executionContext.UserContext);

            var mappedResults = await _customEntitySummaryMapper.MapAsync(dbResults, executionContext);

            return(mappedResults.ToDictionary(r => r.CustomEntityId));
        }