public ActionResult Create(int CaseID, Models.vw_PersonData PersonData, CasePartyViewModels CasePartyViewModels)
 {
     using (var Transaction = DataContext.Database.BeginTransaction())
     {
         if (ModelState.IsValid)
         {
             long         PersonID;
             PersonStatus AddPerson;
             if (PersonData.ID == 0)
             {
                 AddPerson = PersonService.AddPerson(new Base.Views.vw_PersonData
                 {
                     ID            = PersonData.ID,
                     Job           = PersonData.Job,
                     BirthDate     = PersonData.GetBirthDate(),
                     Name          = PersonData.Name,
                     NationalityID = PersonData.NationalityID,
                     NatNo         = PersonData.NatNo,
                     PassportNo    = PersonData.PassportNo,
                     address       = (PersonData.address_address != null ? new Base.Views.vw_Address {
                         address = PersonData.address_address, CityID = PersonData.address_CityID, PoliceStationID = PersonData.address_PoliceStationID
                     } : null),
                     CleanFullName = Base.Utilities.RemoveSpaces(Base.Utilities.RemoveSpecialCharacters(PersonData.Name)),
                 }, out PersonID);
             }
             else
             {
                 PersonID  = PersonData.ID;
                 AddPerson = PersonStatus.SuccefullSave;
             }
             if (PartiesService.IsPersonInCase(PersonID, CaseID))
             {
                 return(CPartialView(PrepareCasePartiesViewModel(CaseID, PersonData, CasePartyViewModels)).WithErrorMessages("الخصم مسجل فى القضيه من قبل"));
             }
             else if (AddPerson == Base.PersonStatus.SuccefullSave)
             {
                 var AddStatus = PartiesService.AddCaseDefect(new vw_CaseDefectData
                 {
                     CaseID                 = CaseID,
                     Crimes                 = CasePartyViewModels.CrimeTypes,
                     DefectType             = CasePartyViewModels.PartyType,
                     IsCivilRightProsecutor = CasePartyViewModels.IsCivilRightProsecutor,
                     PersonID               = PersonID,
                     DefendantStatus        = CasePartyViewModels.DefendantStatus ?? 0,
                 });
                 switch (AddStatus)
                 {
                 case Base.SaveDefectsStatus.Saved:
                     Transaction.Commit();
                     ViewBag.SavedCreate = true;
                     //    JavaScript("$(document).trigger('Parties:SavedSuccefull')");
                     return(CPartialView(PrepareCasePartiesViewModel(CaseID, PersonData, CasePartyViewModels)).WithSuccessMessages(JIC.Base.Resources.Messages.OperationCompletedSuccessfully));
                 }
             }
         }
         return(CPartialView(PrepareCasePartiesViewModel(CaseID, PersonData, CasePartyViewModels)));
     }
 }