public async Task <IResourceCollectionDocument> BuildDocument <T>(IQueryable <T> query, HttpRequestMessage request, string[] sortExpressions, CancellationToken cancellationToken,
                                                                          string[] includes = null)
        {
            var filteredQuery = _filteringTransformer.Filter(query, request);
            var sortedQuery   = _sortingTransformer.Sort(filteredQuery, sortExpressions);

            var paginationResults = _paginationTransformer.ApplyPagination(sortedQuery, request);
            var paginatedQuery    = paginationResults.PagedQuery;

            var linkBaseUrl = _baseUrlService.GetBaseUrl(request);

            var results = await _enumerationTransformer.Enumerate(paginatedQuery, cancellationToken);

            var metadata = await GetDocumentMetadata(query, filteredQuery, sortedQuery, paginationResults, cancellationToken);

            return(_resourceCollectionDocumentBuilder.BuildDocument(results, linkBaseUrl, includes, metadata, null));
        }
        internal IQueryable <T> Transform <T>(IQueryableFilteringTransformer filteringTransformer, IQueryable <T> query, string uri)
        {
            var request = new HttpRequestMessage(HttpMethod.Get, uri);

            return(filteringTransformer.Filter(query, request));
        }