public ActionResult Delete(Guid id, FormCollection collection) { try { // TODO: Add delete logic here List <MembershipModel> memberships = membershipsRepository.GetAllMembershipsByMembershipTypeId(id); foreach (MembershipModel membership in memberships) { membershipsRepository.DeleteMembership(membership.IDMembership); } membershipTypeRepository.DeleteMembershipType(id); return(RedirectToAction("Index")); } catch { return(View("Delete")); } }