// Token: 0x060007BC RID: 1980 RVA: 0x00037DC8 File Offset: 0x00035FC8
        public static void CleanUp(MailboxSession mailboxSession, MeetingMessage item, CalendarItemBase originalCalItem, Trace tracer, out bool fullUpdateDeleted)
        {
            fullUpdateDeleted = false;
            byte[] valueOrDefault = item.GetValueOrDefault <byte[]>(CalendarItemBaseSchema.GlobalObjectId, null);
            if (valueOrDefault == null)
            {
                return;
            }
            int valueOrDefault2 = item.GetValueOrDefault <int>(CalendarItemBaseSchema.AppointmentSequenceNumber, -1);

            if (valueOrDefault2 == -1)
            {
                return;
            }
            OldMessageDeletion.LatestItemInfo latestInfo;
            latestInfo.LatestSequenceNumber = -1;
            List <VersionedId> oldMeetingMessages = RUMOldMessageDeletion.GetOldMeetingMessages(mailboxSession, item, valueOrDefault, valueOrDefault2, out latestInfo);

            if (oldMeetingMessages == null && latestInfo.LatestSequenceNumber >= valueOrDefault2)
            {
                RUMOldMessageDeletion.MarkMeetingMessageAsOld(item, tracer);
                fullUpdateDeleted = false;
                return;
            }
            if (oldMeetingMessages != null && oldMeetingMessages.Count > 0)
            {
                foreach (VersionedId storeId in oldMeetingMessages)
                {
                    using (MeetingMessage meetingMessage = MeetingMessage.Bind(mailboxSession, storeId))
                    {
                        RUMOldMessageDeletion.MarkMeetingMessageAsOld(meetingMessage, tracer);
                    }
                }
            }
            MeetingRequest meetingRequest = item as MeetingRequest;

            if (meetingRequest != null)
            {
                OldMessageDeletion.ApplyRollingHighlight(meetingRequest, item.InternetMessageId, originalCalItem, latestInfo);
            }
            fullUpdateDeleted = latestInfo.FullUpdateDeleted;
        }
        // Token: 0x060007AE RID: 1966 RVA: 0x00036C68 File Offset: 0x00034E68
        private void DeleteOldMessages(MailboxSession itemStore, MeetingMessage item, CalendarItemBase originalCalItem, out bool fullUpdateDeleted)
        {
            fullUpdateDeleted = false;
            string text = (string)Utils.SafeGetProperty(item, ItemSchema.InternetMessageId, "<null>");

            if (item is MeetingRequest || item is MeetingCancellation)
            {
                bool flag = (bool)Utils.SafeGetProperty(item, MeetingMessageSchema.HijackedMeeting, false);
                if (flag)
                {
                    CalendarAssistantLog.LogEntry(itemStore, "Message {0} has been hijacked, skipping deletion of old messages.", new object[]
                    {
                        text
                    });
                    return;
                }
            }
            int num = (int)Utils.SafeGetProperty(item, CalendarItemBaseSchema.AppointmentSequenceNumber, -1);

            if (num < 0)
            {
                OldMessageDeletion.Tracer.TraceError <object, string>((long)this.GetHashCode(), "{0}: Message does not have a sequence number, skipping {1}", TraceContext.Get(), text);
                CalendarAssistantLog.LogEntry(itemStore, "Message does not have a sequence number, skipping {0}", new object[]
                {
                    text
                });
                return;
            }
            if (OldMessageDeletion.ShouldIgnoreFolder(itemStore, item.ParentId))
            {
                return;
            }
            string text2 = (string)Utils.SafeGetProperty(item, MessageItemSchema.ReceivedRepresentingEmailAddress, string.Empty);
            string text3 = (string)Utils.SafeGetProperty(item, CalendarItemBaseSchema.OrganizerEmailAddress, string.Empty);

            byte[] array = (byte[])Utils.SafeGetProperty(item, CalendarItemBaseSchema.GlobalObjectId, null);
            if (array == null)
            {
                OldMessageDeletion.Tracer.TraceError <object, string>((long)this.GetHashCode(), "{0}: Message {1} does not have a globalObjectId, skipping the message.", TraceContext.Get(), text);
                CalendarAssistantLog.LogEntry(itemStore, "Message {0} does not have a globalObjectId, skipping the message.", new object[]
                {
                    text
                });
                return;
            }
            OldMessageDeletion.Tracer.TraceDebug <object, string, string>((long)item.GetHashCode(), "{0}: Received representing={1} sent representing={2}", TraceContext.Get(), text2, text3);
            CalendarAssistant.TracerPfd.TracePfd((long)item.GetHashCode(), "PFD IWC {0} {1}: Received representing={2} sent representing={3}", new object[]
            {
                22679,
                TraceContext.Get(),
                text2,
                text3
            });
            if (!itemStore.IsGroupMailbox() && string.Compare(text2, text3, true) == 0)
            {
                Participant participant = null;
                if (!OldMessageDeletion.IsSenderSame(item.Sender, itemStore, out participant))
                {
                    return;
                }
                AggregateOperationResult aggregateOperationResult = itemStore.Delete(DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                {
                    item.Id
                });
                OldMessageDeletion.Tracer.TraceDebug <object, string, OperationResult>((long)this.GetHashCode(), "{0}: Moving the item {1} to the Deleted Items folder returned:{2}", TraceContext.Get(), text, aggregateOperationResult.OperationResult);
                return;
            }
            else
            {
                if (item.IsRepairUpdateMessage)
                {
                    RUMOldMessageDeletion.CleanUp(itemStore, item, originalCalItem, OldMessageDeletion.Tracer, out fullUpdateDeleted);
                    return;
                }
                OldMessageDeletion.LatestItemInfo latestItemInfo;
                latestItemInfo.FullUpdateDeleted      = fullUpdateDeleted;
                latestItemInfo.RollingHighlight       = (int)Utils.SafeGetProperty(item, CalendarItemBaseSchema.ChangeHighlight, 0);
                latestItemInfo.LatestOldStartTime     = ExDateTime.MinValue;
                latestItemInfo.LatestOldEndTime       = ExDateTime.MinValue;
                latestItemInfo.LatestOldLocationStr   = string.Empty;
                latestItemInfo.LatestSequenceNumber   = -1;
                latestItemInfo.LatestItemId           = item.Id;
                latestItemInfo.LatestClientSubmitTime = (ExDateTime)Utils.SafeGetProperty(item, ItemSchema.SentTime, ExDateTime.MinValue);
                this.QueryAndDeleteMatchingItems(itemStore, item, originalCalItem, array, text, text3, num, ref latestItemInfo);
                fullUpdateDeleted = latestItemInfo.FullUpdateDeleted;
                return;
            }
        }