public virtual async Task <GridModel> GetPagedListAsync(IGridExpressionGenerator <TEntity> gridExpressionGenerator, BaseGrid <TEntity> grid, CancellationToken ct)
        {
            var query = DbSet
                        .AsNoTracking()
                        .AsQueryable()
                        .IncludeMany(grid.GetIncludedEntities())
                        .Where(gridExpressionGenerator.GetGridExpression(grid))
                        .Ordered(grid.GetSortedSortingOptions());

            int totalCount = await query.CountAsync(ct);

            var summaries = grid.GetGridSummaries(query);

            query = query
                    .Skip(grid.Pagination.PageSize * (grid.Pagination.PageNumber - 1))
                    .Take(grid.Pagination.PageSize);

            var items = await query.ToListAsync(ct);

            if (!grid.IsGroupable)
            {
                return(new GridModel(summaries, items.Cast <dynamic>().ToImmutableList(), totalCount));
            }

            return(grid.GetGroupedGridItems(items, summaries, totalCount));
        }