public async Task <IActionResult> GetRelatedCountryByIdAsync(int contactId) { CountryDto countryDto; try { var country = await _countryManager.GetByContactIdAsync(contactId); countryDto = _mapper.Map <CountryDto>(country); } catch (EntityNotFoundException) { countryDto = null; } var links = _jsonApiBuilder.BuildSingleResourceLinks(HttpContext.Request.Path); return(Ok(new ResourceResponse() { Links = links, Data = countryDto })); }