public async Task <IActionResult> Edit(string id, RecipeEditInputModel recipeEditInputModel)
        {
            if (!this.ModelState.IsValid)
            {
                recipeEditInputModel.RecipeViewData = await this.recipeService.GetRecipeViewDataModelAsync();

                recipeEditInputModel.NeededTime = this.enumParseService
                                                  .GetEnumDescription(recipeEditInputModel.NeededTime, typeof(Period));

                return(this.View(recipeEditInputModel));
            }

            var recipeServiceModel = recipeEditInputModel.To <RecipeServiceModel>();

            var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);

            recipeServiceModel.UserId = userId;

            var photoUrl = await this.cloudinaryService.UploadPhotoAsync(
                recipeEditInputModel.Photo,
                $"{userId}-{recipeEditInputModel.Title}",
                GlobalConstants.CloudFolderForRecipePhotos);

            recipeServiceModel.Photo = photoUrl;

            foreach (var allergenName in recipeEditInputModel.AllergenNames)
            {
                recipeServiceModel.Allergens.Add(new RecipeAllergenServiceModel
                {
                    Allergen = new AllergenServiceModel {
                        Name = allergenName
                    },
                });
            }

            foreach (var lifestyleType in recipeEditInputModel.LifestyleTypes)
            {
                recipeServiceModel.Lifestyles.Add(new RecipeLifestyleServiceModel
                {
                    Lifestyle = new LifestyleServiceModel {
                        Type = lifestyleType
                    },
                });
            }

            recipeServiceModel.NeededTime = this.enumParseService
                                            .Parse <Period>(recipeEditInputModel.NeededTime);

            if (!await this.recipeService.EditAsync(id, recipeServiceModel))
            {
                this.TempData["Error"] = EditErrorMessage;

                recipeEditInputModel.RecipeViewData = await this.recipeService.GetRecipeViewDataModelAsync();

                recipeEditInputModel.NeededTime = this.enumParseService
                                                  .GetEnumDescription(recipeEditInputModel.NeededTime, typeof(Period));

                return(this.View(recipeEditInputModel));
            }

            this.TempData["Success"] = EditSuccessMessage;

            return(this.Redirect($"/Recipes/Details/{id}"));
        }