public ActionResult Delete(LoanDeleteVm vm) { try { // Before we delete a loan we als clean the BookCopyLoans attached to this loan ID in the db _bookCopyLoanService.DeleteBookCopyLoansByLoanId(vm.LoanId); _loanService.DeleteLoanByLoanId(vm.LoanId); return(RedirectToAction(nameof(Index))); } // we use general exception to also catch the null exception catch (Exception) { return(RedirectToAction(nameof(Delete))); } }