private static void GetDefaultPolicyInfo(MailboxSession mailboxSession, MessageItem messageItem, object compactDefaultPolicy, out Guid defaultGuid, out int periodInStartDateEtc)
        {
            defaultGuid          = Guid.Empty;
            periodInStartDateEtc = 0;
            Guid guid  = Guid.Empty;
            Guid guid2 = Guid.Empty;

            if (compactDefaultPolicy != null & compactDefaultPolicy is byte[])
            {
                Dictionary <Guid, StoreTagData>     dictionary = MrmFaiFormatter.Deserialize(compactDefaultPolicy as byte[], mailboxSession.MailboxOwner);
                List <ElcPolicySettings>            list       = new List <ElcPolicySettings>();
                Dictionary <string, ContentSetting> itemClassToPolicyMapping = new Dictionary <string, ContentSetting>();
                foreach (StoreTagData storeTagData in dictionary.Values)
                {
                    if (storeTagData.Tag.Type == ElcFolderType.All)
                    {
                        foreach (ContentSetting contentSetting in storeTagData.ContentSettings.Values)
                        {
                            ElcPolicySettings.ParseContentSettings(list, contentSetting);
                            if (contentSetting.MessageClass.Equals(ElcMessageClass.AllMailboxContent, StringComparison.CurrentCultureIgnoreCase))
                            {
                                guid2 = storeTagData.Tag.RetentionId;
                            }
                            else if (contentSetting.MessageClass.Equals(ElcMessageClass.VoiceMail, StringComparison.CurrentCultureIgnoreCase))
                            {
                                guid = storeTagData.Tag.RetentionId;
                            }
                        }
                    }
                }
                string effectiveItemClass = ElcPolicySettings.GetEffectiveItemClass(messageItem.ClassName);
                if (effectiveItemClass.StartsWith(ElcMessageClass.VoiceMail.TrimEnd(new char[]
                {
                    '*'
                }), StringComparison.OrdinalIgnoreCase) && !guid.Equals(Guid.Empty))
                {
                    defaultGuid = guid;
                }
                else if (!guid2.Equals(Guid.Empty))
                {
                    defaultGuid = guid2;
                }
                ContentSetting applyingPolicy = ElcPolicySettings.GetApplyingPolicy(list, messageItem.ClassName, itemClassToPolicyMapping);
                if (applyingPolicy != null && applyingPolicy.RetentionEnabled && applyingPolicy.AgeLimitForRetention != null)
                {
                    periodInStartDateEtc = (int)applyingPolicy.AgeLimitForRetention.Value.TotalDays;
                    return;
                }
                if (applyingPolicy == null)
                {
                    defaultGuid = Guid.Empty;
                }
            }
        }
 internal static ContentSetting GetApplyingPolicy(List <ElcPolicySettings> elcPolicies, string itemClass, Dictionary <string, ContentSetting> itemClassToPolicyMapping)
 {
     return(ElcPolicySettings.GetApplyingPolicy(elcPolicies, itemClass, itemClassToPolicyMapping, itemClass));
 }