public IActionResult GetCustomerAccount(Guid companyId, Guid customerAccountId, string fields,
                                                [FromHeader(Name = "Accept")] string mediaType)
        {
            if (!MediaTypeHeaderValue.TryParse(mediaType,
                                               out MediaTypeHeaderValue parsedMediaType))
            {
                return(BadRequest());
            }

            if (!_propertyCheckerService.TypeHasProperties <CustomerAccountDto>
                    (fields))
            {
                return(BadRequest());
            }

            var customerAccountFromRepo = _customerAccountRepository.GetCustomerAccount(companyId, customerAccountId);

            if (customerAccountFromRepo == null)
            {
                return(NotFound());
            }

            var includeLinks = parsedMediaType.SubTypeWithoutSuffix
                               .EndsWith("hateoas", StringComparison.InvariantCultureIgnoreCase);

            IEnumerable <LinkDto> links = new List <LinkDto>();

            if (includeLinks)
            {
                links = CreateLinksForCustomerAccounts(companyId.ToString(), customerAccountId.ToString(), fields);
            }

            var primaryMediaType = includeLinks ?
                                   parsedMediaType.SubTypeWithoutSuffix
                                   .Substring(0, parsedMediaType.SubTypeWithoutSuffix.Length - 8)
              : parsedMediaType.SubTypeWithoutSuffix;

            // full author
            if (primaryMediaType == "vnd.marvin.customeraccount.full")
            {
                var fullResourceToReturn = _mapper.Map <CustomerAccountFullDto>(customerAccountFromRepo)
                                           .ShapeData(fields) as IDictionary <string, object>;

                if (includeLinks)
                {
                    fullResourceToReturn.Add("links", links);
                }

                return(Ok(fullResourceToReturn));
            }

            // friendly author
            var friendlyResourceToReturn = _mapper.Map <CustomerAccountDto>(customerAccountFromRepo)
                                           .ShapeData(fields) as IDictionary <string, object>;

            if (includeLinks)
            {
                friendlyResourceToReturn.Add("links", links);
            }

            return(Ok(friendlyResourceToReturn));
        }