public static Pizza ConvertPizzaModel(PizzaModel model) { List <Pizza_Ingredient> pizzaIngredient = new List <Pizza_Ingredient>(); Bottom bottom = new Bottom(); if (model == null) { return(null); } if (model.PizzaIngredients != null) { pizzaIngredient = PizzaIngredientFactory.ConvertPizzaIngredientModels(model.PizzaIngredients); } if (model.Bottom != null) { bottom = BottomFactory.ConvertBottom(model.Bottom); } Pizza pizza = new Pizza { Id = model.Id, Name = model.Name, BottomId = bottom.Id, Price = model.Price, OrderRuleId = model.OrderRuleId, PizzaIngredient = pizzaIngredient }; return(pizza); }