public ActionResult UpdateRecipe(int id,
                                         [FromBody] RecipeForUpdateDto recipe,
                                         [FromHeader(Name = ExtendedControllerBase.ACCEPT)] string mediaTypes)
        {
            var splitMediaTypes = mediaTypes.Split(',');

            if (!MediaTypeHeaderValue.TryParseList(splitMediaTypes,
                                                   out IList <MediaTypeHeaderValue> parsedMediaTypes))
            {
                return(BadRequest());
            }

            if (!_homeBrewRepository.WaterProfileExists(recipe.WaterProfileId))
            {
                ModelState.AddModelError(
                    "Description",
                    "The water profile ID for the recipe must exist.");
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var includeSteps = true;
            var recipeEntity = _homeBrewRepository.GetRecipe(id, includeSteps);

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

            _mapper.Map(recipe, recipeEntity);
            _homeBrewRepository.UpdateRecipe(recipeEntity);
            _homeBrewRepository.Save();

            if (parsedMediaTypes.Any(pmt => pmt.SubTypeWithoutSuffix.EndsWith(this.HATEOAS, StringComparison.InvariantCultureIgnoreCase)))
            {
                var links = CreateLinksForRecipe(recipeEntity.Id, includeSteps);

                var recipeToReturn         = _mapper.Map <RecipeDto>(recipeEntity);
                var linkedResourceToReturn = recipeToReturn.ShapeData(null)
                                             as IDictionary <string, object>;

                linkedResourceToReturn.Add(this.LINKS, links);

                return(Ok(linkedResourceToReturn));
            }

            return(NoContent());
        }