public static void UpdateAndSaveTextMessgaingStateOnAdUser(TextMessagingAccount account, ADRecipient adRecipient, IRecipientSession adSession)
 {
     if (account == null)
     {
         throw new ArgumentNullException("account");
     }
     if (adRecipient == null)
     {
         throw new ArgumentNullException("adRecipient");
     }
     if (adSession == null)
     {
         throw new ArgumentNullException("adSession");
     }
     if (TextMessagingHelper.UpdateTextMessagingState(adRecipient.TextMessagingState, account.TextMessagingSettings.DeliveryPoints))
     {
         adSession.Save(adRecipient);
     }
 }
        public static void SaveTextMessagingAccount(TextMessagingAccount account, VersionedXmlDataProvider storeDataProvider, ADRecipient adRecipient, IRecipientSession adSession)
        {
            if (account == null)
            {
                throw new ArgumentNullException("account");
            }
            if (storeDataProvider == null)
            {
                throw new ArgumentNullException("storeDataProvider");
            }
            if (adRecipient == null)
            {
                throw new ArgumentNullException("adRecipient");
            }
            if (adSession == null)
            {
                throw new ArgumentNullException("adSession");
            }
            bool notificationPhoneNumberVerified = account.NotificationPhoneNumberVerified;
            bool dupIdentitiesExist = false;

            account.TextMessagingSettings.DeliveryPoints.Sort(delegate(DeliveryPoint x, DeliveryPoint y)
            {
                if (x.Identity == y.Identity)
                {
                    dupIdentitiesExist = true;
                }
                return(x.Identity.CompareTo(y.Identity));
            });
            if (dupIdentitiesExist)
            {
                int num = 0;
                while (account.TextMessagingSettings.DeliveryPoints.Count > num)
                {
                    account.TextMessagingSettings.DeliveryPoints[num].Identity = (byte)num;
                    num++;
                }
            }
            TextMessagingHelper.UpdateTextMessagingState(adRecipient.TextMessagingState, account.TextMessagingSettings.DeliveryPoints);
            storeDataProvider.Save(account);
            adSession.Save(adRecipient);
        }