public async Task InvokeAsync( HttpContext context, IContentStorage contentStore, ISchemaStorage schemaStorage, JsonService jsonService) { string schema = (string)context.GetRouteValue("schema"); QueryParameters queryParameters = await jsonService.Deserialize <QueryParameters>(context.Request.Body); ContentSchema schemaModel = await schemaStorage.GetContentSchemaAsync(schema); QueryResult <ContentItem> contentItems = await contentStore.Query(schema, queryParameters); foreach (ContentItem contentItem in contentItems.Items) { contentItem.ApplySchema(schemaModel); } QueryResult <RestContentItem> resultQuery = new QueryResult <RestContentItem>() { Offset = contentItems.Offset, Count = contentItems.Count, TotalCount = contentItems.TotalCount, Items = contentItems.Items.Select(x => x.ToRest()).ToList() }; string json = jsonService.Serialize(resultQuery); await context.Response.WriteAsync(json); }