public HttpResponseMessage DeleteBookingById(int bookingId, bool?recurrence = false) { try { Booking booking = _bookingsRepository.GetById(bookingId); User currentUser = _directoryService.GetCurrentUser(User.Identity.Name); _logger.Debug($"CurrentUser: {currentUser?.FullName}"); if (currentUser == null) { return(Request.CreateResponse(HttpStatusCode.NotFound, "User not found in Active Directory. " + User.Identity.Name)); } _bookingService.DeleteExistingBooking(booking, recurrence, currentUser, ConfigurationManager.AppSettings); return(new HttpResponseMessage(HttpStatusCode.OK)); } catch (DeletionException e) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Unable to delete existing booking. An error occured, please contact help desk.")); } catch (Exception ex) { _logger.FatalException("Unable to delete booking: " + bookingId, ex); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } }