public ActionResult <Helper> RemoveHelper(string templateName, int weekNr, int dayNr, int userId) { Day dayToEdit = _dayRepository.GetByWeekAndDay(templateName, weekNr, dayNr); if (dayToEdit == null) { return(NotFound()); } else { Helper helperToRemove = _helperRepository.GetTemplateDayHelper(templateName, weekNr, dayNr, userId); if (helperToRemove == null) { return(NotFound()); } else { try { dayToEdit.RemoveHelper(helperToRemove); _dayRepository.SaveChanges(); return(Ok(helperToRemove)); } catch (Exception ex) { return(BadRequest(ex.Message)); } } } }