/// <summary>
        /// Adds a new Recipe
        /// </summary>
        public void AddNewRecipe(Recipe newRecipe)
        {
            if (newRecipe == null)
            {
                throw new ArgumentNullException("newRecipe");
            }

            var allIngredients = newRecipe.Fermentables
                                 .Union <IRecipeIngredient>(newRecipe.Hops)
                                 .Union(newRecipe.Yeasts)
                                 .Union(newRecipe.Adjuncts);

            // Look for Existing Ingredients to Match Custom Entered Ones
            this.VerifyCustomIngredients(allIngredients.Where(x => x.GetIngredient() != null));

            // Infer the Recipe Type
            newRecipe.RecipeTypeId = (int)RecipeTypeInferer.Infer(newRecipe);

            newRecipe.CreatedBy   = this.UserResolver.Resolve().UserId;
            newRecipe.DateCreated = DateTime.Now;

            // Set Step Date Created
            newRecipe.Steps.ForEach(x => x.DateCreated = DateTime.Now);

            this.Repository.Add(newRecipe);
        }
        /// <summary>
        /// Edits a Recipe
        /// </summary>
        public void EditRecipe(Recipe recipe)
        {
            if (recipe == null)
            {
                throw new ArgumentNullException("recipe");
            }

            recipe.DateModified = DateTime.Now;
            recipe.RecipeTypeId = (int)RecipeTypeInferer.Infer(recipe);
        }
        /// <summary>
        /// Finalizes a recipe for saving
        /// </summary>
        public void FinalizeRecipe(Recipe recipe)
        {
            if (recipe == null)
            {
                throw new ArgumentNullException("recipe");
            }

            var allIngredients = recipe.Fermentables
                                 .Union <IRecipeIngredient>(recipe.Hops)
                                 .Union(recipe.Yeasts)
                                 .Union(recipe.Adjuncts)
                                 .Union(recipe.MashSteps);

            // Look for Existing Ingredients to Match Custom Entered Ones
            this.VerifyCustomIngredients(allIngredients.Where(x => x.IngredientId <= 0));

            // Infer the Recipe Type
            recipe.RecipeTypeId = (int)RecipeTypeInferer.Infer(recipe);

            // Assume Active and Public by Default
            recipe.IsActive = true;
            recipe.IsPublic = true;

            // If Lacking Ingredients, Keep Private (not public)
            // But Not for Recipes with Existing Sessions or Comments or Clones
            if (recipe.RecipeMetaData == null || recipe.RecipeMetaData.BrewSessionCount == 0 && recipe.RecipeMetaData.CommentCount == 0 && recipe.RecipeMetaData.CloneCount == 0)
            {
                if (!recipe.Fermentables.Any(x => x.Amount > 0) || !recipe.Yeasts.Any())
                {
                    recipe.IsPublic = false;
                }
            }

            if (recipe.IsNewRecipe())
            {
                recipe.CreatedBy   = this.UserResolver.Resolve().UserId;
                recipe.DateCreated = DateTime.Now;

                // Set Step Date Created
                if (recipe.Steps != null)
                {
                    recipe.Steps.ForEach(x => x.DateCreated = DateTime.Now);
                }
            }
            else
            {
                recipe.DateModified = DateTime.Now;
            }

            // Add New Recipes to Repo
            if (recipe.IsNewRecipe())
            {
                this.Repository.Add(recipe);
            }
        }