public ActionResult Edit(BatchEditVm entity)
 {
     if (entity.ScheduleExams != null && entity.ScheduleExams.Count > 0 && entity.Trainers != null &&
         entity.Trainers.Count > 0 && entity.Participants != null &&
         entity.Participants.Count > 0)
     {
         if (ModelState.IsValid)
         {
             bool isAdded    = _batchManager.AddExamSchedule(entity.ScheduleExams);
             bool isAssigned = _batchManager.AssignTrainers(entity.Trainers);
             bool isEntered  = _batchManager.AssignParticipants(entity.Participants);
             if (isAssigned == true && isAdded == true)
             {
                 var  batch     = Mapper.Map <Batch>(entity);
                 bool isUpdated = _batchManager.Update(batch);
                 if (isUpdated)
                 {
                     ViewBag.Message = "Updated";
                     return(RedirectToAction("ViewInfo", batch));
                 }
                 else
                 {
                     ViewBag.Message = "Failed";
                     return(View("Edit", entity));
                 }
             }
         }
     }
     ModelState.AddModelError("", "An Unknown Error Occured!");
     entity.ParticipantSelectListItems = GetAllParticipantSlItems();
     entity.TrainerSelectListItems     = GetAllTrainersSlItems();
     entity.ExamSelectListItems        = GetAllExamSlItems();
     return(View("Edit", entity));
 }