private void SaveToService()
		{
			StoreRetentionPolicyTagHelper.InitializePrincipal(this);
			StoreRetentionPolicyTagHelper.InitializeServiceBinding(this);
			if (this.serviceBinding == null)
			{
				throw new ElcUserConfigurationException(Strings.ElcUserConfigurationServiceBindingNotAvailable);
			}
			if (this.configItemExists)
			{
				StoreRetentionPolicyTagHelper.UpdateUserConfiguration(this);
				return;
			}
			StoreRetentionPolicyTagHelper.CreateUserConfiguration(this);
		}
		private static void FetchRetentionPolicyTagDataFromMailbox(StoreRetentionPolicyTagHelper srpth)
		{
			StoreRetentionPolicyTagHelper.InitializePrincipal(srpth);
			if (srpth.exchangePrincipal != null)
			{
				if (srpth.exchangePrincipal.MailboxInfo.Location.ServerVersion >= Server.E14SP1MinVersion)
				{
					ExTraceGlobals.ELCTracer.TraceDebug(0L, "Fetch retention policy tag data from EWS since user's version is " + srpth.exchangePrincipal.MailboxInfo.Location.ServerVersion);
					StoreRetentionPolicyTagHelper.FetchRetentionPolicyTagDataFromService(srpth);
					return;
				}
				ExTraceGlobals.ELCTracer.TraceDebug(0L, "Fetch retention policy tag data from XSO since user's version is " + srpth.exchangePrincipal.MailboxInfo.Location.ServerVersion);
				StoreRetentionPolicyTagHelper.FetchRetentionPolcyTagDataFromXSO(srpth);
			}
		}
		private static void CallEwsWithRetries(Func<BaseResponseMessageType> delegateEwsCall, Func<ResponseMessageType, int, bool> responseMessageProcessor, StoreRetentionPolicyTagHelper srpth)
		{
			ExDateTime t = ExDateTime.UtcNow.Add(StoreRetentionPolicyTagHelper.TotalExecutionTimeWindow);
			Exception ex = null;
			int num = -1;
			bool flag;
			do
			{
				ex = null;
				flag = false;
				try
				{
					BaseResponseMessageType baseResponseMessageType = delegateEwsCall();
					num++;
					int i = 0;
					while (i < baseResponseMessageType.ResponseMessages.Items.Length)
					{
						ResponseMessageType responseMessageType = baseResponseMessageType.ResponseMessages.Items[i];
						if (responseMessageProcessor != null && responseMessageProcessor(responseMessageType, i))
						{
							ExTraceGlobals.ELCTracer.TraceDebug(0L, "Successfully executed EWS call");
							break;
						}
						if (responseMessageType.ResponseClass == ResponseClassType.Error)
						{
							if (responseMessageType.ResponseCode == ResponseCodeType.ErrorCrossSiteRequest)
							{
								ExTraceGlobals.ELCTracer.TraceDebug(0L, "Crosssite request error , recreate exchange binding and reset the url caches");
								flag = true;
								StoreRetentionPolicyTagHelper.InitializePrincipal(srpth);
								StoreRetentionPolicyTagHelper.InitializeServiceBinding(srpth);
								break;
							}
							if (!StoreRetentionPolicyTagHelper.TransientServiceErrors.Contains(responseMessageType.ResponseCode))
							{
								ExTraceGlobals.ELCTracer.TraceError(0L, string.Format("Permanent error encountered:  {0}, {1}, {2}", responseMessageType.ResponseClass.ToString(), responseMessageType.ResponseCode.ToString(), responseMessageType.MessageText.ToString()));
								throw new ElcUserConfigurationException(Strings.FailedToGetElcUserConfigurationFromService(responseMessageType.ResponseClass.ToString(), responseMessageType.ResponseCode.ToString(), responseMessageType.MessageText.ToString()));
							}
							flag = true;
							ex = new ElcUserConfigurationException(Strings.FailedToGetElcUserConfigurationFromService(responseMessageType.ResponseClass.ToString(), responseMessageType.ResponseCode.ToString(), responseMessageType.MessageText.ToString()));
							ExTraceGlobals.ELCTracer.TraceDebug(0L, "Transient error encountered, will attempt to retry, Exception: " + ex);
							break;
						}
						else
						{
							i++;
						}
					}
				}
				catch (CommunicationException ex2)
				{
					ex = ex2;
					ExTraceGlobals.ELCTracer.TraceDebug(0L, "Transient error encountered, will attempt to retry, Exception: " + ex);
					flag = true;
				}
				catch (WebException ex3)
				{
					ex = ex3;
					ExTraceGlobals.ELCTracer.TraceDebug(0L, "Transient error encountered, will attempt to retry, Exception: " + ex);
					flag = true;
				}
				catch (TimeoutException ex4)
				{
					ex = ex4;
					flag = false;
				}
				catch (SoapException ex5)
				{
					ex = ex5;
					flag = false;
				}
				catch (IOException ex6)
				{
					ex = ex6;
					flag = false;
				}
				catch (InvalidOperationException ex7)
				{
					ex = ex7;
					flag = false;
				}
				catch (LocalizedException ex8)
				{
					ex = ex8;
					flag = false;
				}
			}
			while (flag && t > ExDateTime.UtcNow);
			if (ex != null)
			{
				ExTraceGlobals.ELCTracer.TraceError(0L, string.Format("Failed to access elc user configuration.  Total attempts made {0}, Exception: {1} ", num, ex));
				throw new ElcUserConfigurationException(Strings.ErrorElcUserConfigurationServiceCall, ex);
			}
		}