private static function set_product_ingredients($product, $ingredients)
 {
     foreach ($ingredients as $ingredient_name) {
         if ($ingredient_name != 'empty') {
             $product->ingredients[] = Ingredient::findByName($ingredient_name);
         }
     }
 }
 private static function set_product_ingredients($product, $ingredients)
 {
     ProductIngredient::deleteByProduct($product->id);
     foreach ($ingredients as $ingredient_name) {
         if ($ingredient_name != 'empty') {
             $ingredient = Ingredient::findByName($ingredient_name);
             $product_ingredient = new ProductIngredient(array('ingredient_id' => $ingredient->id, 'product_id' => $product->id));
             $product_ingredient->save();
         }
     }
 }