public async Task <IActionResult> GetByIdAsync(int id) { var querySet = _jsonApiBuilder.BuildQuerySet(HttpContext.Request.Query); var building = await _buildingManager.GetByIdAsync(id, querySet); var buildingDto = _mapper.Map <BuildingDto>(building, opt => opt.Items["include"] = querySet.Include); var included = _includedCollector.CollectIncluded(building, querySet.Include); var links = _jsonApiBuilder.BuildSingleResourceLinks(HttpContext.Request.Path, querySet); return(Ok(new ResourceResponse() { Links = links, Data = buildingDto, Included = included })); }