public IHttpActionResult DeleteToppingFromPizza(string pizzaName, string toppingName) { try { Core.Core core = new Core.Core(); var pizza = core.GetPizza(pizzaName); if (pizza == null) { throw new NullReferenceException("'" + pizzaName + "' Pizza Not Found"); } else { var topping = core.GetTopping(toppingName); if (topping == null) { throw new NullReferenceException("'" + toppingName + "' Topping Not Found"); } else { bool result = core.DeleteToppingFromPizza(topping, pizza); if (!result) { throw new Exception("'" + toppingName + "' Topping could not be deleted"); } } } return(Content(HttpStatusCode.OK, new { Code = (int)HttpStatusCode.OK, Message = "Topping successfully deleted" })); } catch (Exception ex) { return(Content(HttpStatusCode.InternalServerError, new { Code = (int)HttpStatusCode.InternalServerError, Message = ex.Message })); } }