public IActionResult DeleteEvent(Guid id) { var eventFromRepository = _calendarRepository.GetEvent(id); if (eventFromRepository == null) { return(NotFound()); } _calendarRepository.DeleteEvent(eventFromRepository); if (!_calendarRepository.Save()) { throw new Exception("Failed to delete EventEntity on save."); } return(NoContent()); }