public Tuple <bool, string> AddOrUpdateAuthentication(AuthenticationModel authenticationModel, StateOperation stateOperation)
 {
     try
     {
         if (stateOperation == StateOperation.درج)
         {
             var authentication = _authenticationRepository.Find(x => x.IdentityCode == authenticationModel.IdentityCode);
             if (authentication != null)
             {
                 return(new Tuple <bool, string>(false, "خطا در انجام عملیات : کد شناسایی مورد نظر تکراری می باشد"));
             }
             Authentication newAuthentication = new Authentication
             {
                 AuthenticationType    = authenticationModel.AuthenticationType,
                 IdentityCode          = authenticationModel.IdentityCode,
                 CentralOrganizationId = authenticationModel.CentralOrganizationId,
                 BranchProvinceId      = authenticationModel.BranchProvinceId,
                 UniversityId          = authenticationModel.UniversityId
             };
             _authenticationRepository.Add(newAuthentication);
         }
         else
         {
             if (_authenticationRepository.Contains(x => x.Id != authenticationModel.Id && x.IdentityCode == authenticationModel.IdentityCode))
             {
                 return(new Tuple <bool, string>(false, "خطا در انجام عملیات : کد شناسایی مورد نظر تکراری می باشد"));
             }
             var authentication = _authenticationRepository.Find(x => x.Id == authenticationModel.Id);
             if (authentication == null)
             {
                 return(new Tuple <bool, string>(false, "خطا در انجام عملیات : رکورد مورد نظر یافت نشد"));
             }
             authentication.IdentityCode       = authenticationModel.IdentityCode;
             authentication.AuthenticationType = authenticationModel.AuthenticationType;
             //authentication.CentralOrganizationId = authenticationModel.CentralOrganizationId;
             //authentication.BranchProvinceId = authenticationModel.BranchProvinceId;
             //authentication.UniversityId = authenticationModel.UniversityId;
             _authenticationRepository.Update(authentication);
         }
         _unitOfWork.SaveChanges();
         return(new Tuple <bool, string>(true, "عملیات ثبت شد"));
     }
     catch (Exception ex)
     {
         return(new Tuple <bool, string>(false, "خطا در انجام عملیات"));
     }
 }