private static Persona GetPersonaFromADObject(ADRawEntry rawEntry)
        {
            if (rawEntry == null)
            {
                return(null);
            }
            ADObjectId adobjectId = rawEntry[ADObjectSchema.Id] as ADObjectId;

            if (adobjectId == null)
            {
                return(null);
            }
            Persona persona = new Persona();

            persona.PersonaId = IdConverter.PersonaIdFromADObjectId(adobjectId.ObjectGuid);
            RecipientType        recipientType        = (RecipientType)rawEntry[ADRecipientSchema.RecipientType];
            PersonType           personType           = ADRecipient.IsRecipientTypeDL(recipientType) ? PersonType.DistributionList : PersonType.Person;
            RecipientTypeDetails recipientTypeDetails = (RecipientTypeDetails)rawEntry[ADRecipientSchema.RecipientTypeDetails];

            if (recipientTypeDetails == RecipientTypeDetails.GroupMailbox)
            {
                personType = PersonType.ModernGroup;
            }
            persona.PersonaType = PersonaTypeConverter.ToString(personType);
            object obj = rawEntry[ADRecipientSchema.DisplayName];

            if (obj != null)
            {
                persona.DisplayName = (obj as string);
            }
            object obj2 = rawEntry[ADRecipientSchema.PrimarySmtpAddress];

            if (obj2 != null)
            {
                persona.EmailAddress = new EmailAddressWrapper
                {
                    Name         = (persona.DisplayName ?? string.Empty),
                    EmailAddress = obj2.ToString(),
                    RoutingType  = "SMTP",
                    MailboxType  = MailboxHelper.ConvertToMailboxType(personType).ToString()
                };
            }
            object obj3 = rawEntry[ADUserSchema.RTCSIPPrimaryUserAddress];

            if (obj3 != null)
            {
                persona.ImAddress = obj3.ToString();
            }
            return(persona);
        }