// Token: 0x06000778 RID: 1912 RVA: 0x000348C8 File Offset: 0x00032AC8
        private void HandleDelegateRuleMessage(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item)
        {
            if (mapiEvent.ItemEntryId == null)
            {
                return;
            }
            if (mapiEvent.EventMask == MapiEventTypeFlags.ObjectDeleted)
            {
                DelegateRulesManagementLogger.LogEntry(itemStore, string.Format("Client Type: {0} \nEvent: {1} \nMapiEvent ItemEntryID : {2}\n", mapiEvent.ClientType, mapiEvent.EventMask, mapiEvent.ItemEntryIdString));
                return;
            }
            Rule delegateRule = this.GetDelegateRule(mapiEvent, itemStore);

            if (mapiEvent.EventMask != MapiEventTypeFlags.ObjectDeleted && delegateRule != null)
            {
                try
                {
                    DelegateUserCollection delegateUserCollection = new DelegateUserCollection(itemStore);
                    DelegateRulesManagementLogger.LogEntry(itemStore, string.Format("Client Type: {0} \nEvent: {1} \nTotal Inbox Rules count: {2} \nDelegate RuleName: Delegate Rule {3}, Delegate RuleProvider: {4} \nDelegates added for {5}: {6} \nDelegate can see Private Items: {7} \nDelegate RuleType for {8}: {9} \nMapiEvent ItemEntryID : {10}\n", new object[]
                    {
                        mapiEvent.ClientType,
                        mapiEvent.EventMask,
                        itemStore.AllInboxRules.Count,
                        delegateRule.ID,
                        delegateRule.Provider,
                        itemStore.DisplayName,
                        string.Join(",", delegateUserCollection.DelegateRestoreInfo.Names),
                        string.Join <int>(",", delegateUserCollection.DelegateRestoreInfo.Flags),
                        itemStore.DisplayName,
                        delegateUserCollection.DelegateRuleType,
                        mapiEvent.ItemEntryIdString
                    }));
                }
                catch (DelegateUserNoFreeBusyFolderException)
                {
                    CalendarAssistant.GeneralTracer.TraceDebug((long)this.GetHashCode(), "{0}: FreeBusy folder does not exist. Skipping Delegate Rules Logging.", new object[]
                    {
                        TraceContext.Get()
                    });
                    CalendarAssistantLog.LogEntry(itemStore, "Could not get FreeBusy folder id", new object[0]);
                }
            }
        }
        // Token: 0x06000781 RID: 1921 RVA: 0x00035210 File Offset: 0x00033410
        internal static bool GetCalendarItem(MeetingMessage mtgMessage, Trace tracer, ref CalendarItemBase originalCalItem, bool shouldDetectDuplicateIds, out IEnumerable <VersionedId> detectedDuplicatesIds, out Exception exception)
        {
            MailboxSession session = mtgMessage.Session as MailboxSession;
            bool           result  = true;

            exception       = null;
            originalCalItem = null;
            try
            {
                originalCalItem = mtgMessage.GetCorrelatedItem(shouldDetectDuplicateIds, out detectedDuplicatesIds);
            }
            catch (ObjectNotFoundException ex)
            {
                detectedDuplicatesIds = null;
                result    = false;
                exception = ex;
            }
            catch (CorruptDataException ex2)
            {
                tracer.TraceError <object, VersionedId>(0L, "{0}: There was an error opening the original CalendarItem associated with this message {1}. This message will be skipped.", TraceContext.Get(), mtgMessage.Id);
                CalendarAssistantLog.LogEntry(session, ex2, false, "There was an error opening the original CalendarItem associated with this message {0}. This message will be skipped.", new object[]
                {
                    mtgMessage.Id
                });
                detectedDuplicatesIds = null;
                result    = false;
                exception = ex2;
            }
            catch (CorrelationFailedException ex3)
            {
                tracer.TraceError <object, VersionedId>(0L, "{0}: The original CalendarItem associated with this message {1} is a master, but this message is a single occurrence. This message will be skipped.", TraceContext.Get(), mtgMessage.Id);
                CalendarAssistantLog.LogEntry(session, ex3, false, "The original CalendarItem associated with this message {0} is a master, but this message is a single occurrence. This message will be skipped.", new object[]
                {
                    mtgMessage.Id
                });
                detectedDuplicatesIds = null;
                result    = false;
                exception = ex3;
            }
            catch (VirusDetectedException ex4)
            {
                tracer.TraceError <object, VersionedId>(0L, "{0}: A virus was detected in the CalendarItem associated with this message {1}. This message will be skipped.", TraceContext.Get(), mtgMessage.Id);
                CalendarAssistantLog.LogEntry(session, ex4, false, "A virus was detected in the CalendarItem associated with this message {0}. This message will be skipped.", new object[]
                {
                    mtgMessage.Id
                });
                detectedDuplicatesIds = null;
                result    = false;
                exception = ex4;
            }
            catch (VirusMessageDeletedException ex5)
            {
                tracer.TraceError <object, VersionedId>(0L, "{0}: A virus was detected in the CalendarItem associated with this message and was deleted {1}. This message will be skipped.", TraceContext.Get(), mtgMessage.Id);
                CalendarAssistantLog.LogEntry(session, ex5, false, "A virus was detected in the CalendarItem associated with this message and was deleted {0}. This message will be skipped.", new object[]
                {
                    mtgMessage.Id
                });
                detectedDuplicatesIds = null;
                result    = false;
                exception = ex5;
            }
            catch (RecurrenceException ex6)
            {
                tracer.TraceError <object, VersionedId, RecurrenceException>(0L, "{0}: There was a problem with the recurrence blob. Messageid={1}. This message will be skipped. Exception {2}", TraceContext.Get(), mtgMessage.Id, ex6);
                CalendarAssistantLog.LogEntry(session, ex6, false, "There was a problem with the recurrence blob. Messageid={0}. This message will be skipped", new object[]
                {
                    mtgMessage.Id
                });
                detectedDuplicatesIds = null;
                result    = false;
                exception = ex6;
            }
            if (originalCalItem == null)
            {
                tracer.TraceDebug <object, VersionedId>(0L, "{0}: Original CalendarItem is null for message {1}.", TraceContext.Get(), mtgMessage.Id);
            }
            return(result);
        }
        // Token: 0x06000779 RID: 1913 RVA: 0x00034A3C File Offset: 0x00032C3C
        private void HandleMeetingMessage(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item, List <KeyValuePair <string, object> > customDataToLog)
        {
            if (item == null)
            {
                string objectClass = mapiEvent.ObjectClass;
            }
            else
            {
                string className = item.ClassName;
            }
            if (itemStore.GetDefaultFolderId(DefaultFolderType.Calendar) == null)
            {
                CalendarAssistant.GeneralTracer.TraceDebug((long)this.GetHashCode(), "{0}: Calendar folder does not exist. Skipping processing.", new object[]
                {
                    TraceContext.Get()
                });
                CalendarAssistantLog.LogEntry(itemStore, "Could not get default folder id", new object[0]);
                return;
            }
            if (item == null)
            {
                return;
            }
            MeetingMessage meetingMessage = item as MeetingMessage;

            if (meetingMessage != null && meetingMessage.IsArchiveMigratedMessage)
            {
                CalendarAssistant.CachedStateTracer.TraceDebug((long)this.GetHashCode(), "{0}: Skipping the processing of the meeting item as this is an EHA migration traffic.", new object[]
                {
                    TraceContext.Get()
                });
                return;
            }
            CachedState cachedState = AssistantsService.CachedObjectsList.GetCachedState(mapiEvent.MailboxGuid);
            bool        flag        = ResourceCheck.DetailedCheckForAutomatedBooking(mapiEvent, itemStore, item, cachedState);

            if (itemStore != null)
            {
                string legacyDn = itemStore.MailboxOwner.LegacyDn;
            }
            if (flag)
            {
                CalendarAssistant.CachedStateTracer.TraceDebug((long)this.GetHashCode(), "{0}: Updated the cachedState object, but this is a resource mailbox.", new object[]
                {
                    TraceContext.Get()
                });
                return;
            }
            cachedState.LockForRead();
            CalendarConfiguration calendarConfiguration;

            try
            {
                calendarConfiguration = (cachedState.State[0] as CalendarConfiguration);
            }
            finally
            {
                cachedState.ReleaseReaderLock();
            }
            if (calendarConfiguration.SkipProcessing)
            {
                CalendarAssistant.CachedStateTracer.TraceDebug((long)this.GetHashCode(), "{0}: SkipProcessing is set.", new object[]
                {
                    TraceContext.Get()
                });
                return;
            }
            if (CalendarAssistant.ShouldIgnoreMessage(itemStore, item.ParentId, meetingMessage))
            {
                return;
            }
            string text = (string)Utils.SafeGetProperty(item, ItemSchema.InternetMessageId, "<null>");

            if (CalendarAssistant.ShouldProcessMessageClass(mapiEvent) && CalendarAssistant.ShouldProcessSeriesMessages(mapiEvent, itemStore))
            {
                bool     flag2  = false;
                DateTime utcNow = DateTime.UtcNow;
                if (meetingMessage != null)
                {
                    CalendarItemBase calendarItemBase = null;
                    try
                    {
                        if (meetingMessage.IsDelegated())
                        {
                            this.calProcessor.OldMessageDeletion.PerformCleanUp(itemStore, item, calendarConfiguration, calendarItemBase, null);
                        }
                        else
                        {
                            IEnumerable <VersionedId> duplicates;
                            bool calendarItem = CalendarAssistant.GetCalendarItem(meetingMessage, CalendarAssistant.UnexpectedPathTracer, ref calendarItemBase, true, out duplicates);
                            if (calendarItem)
                            {
                                this.calProcessor.ProcessMeetingMessage(itemStore, meetingMessage, ref calendarItemBase, calendarConfiguration, duplicates, true, itemStore.MailboxOwner.IsResource.Value);
                            }
                        }
                    }
                    catch (OccurrenceCrossingBoundaryException ex)
                    {
                        CalendarAssistant.ProcessingTracer.TraceDebug <object, VersionedId>((long)meetingMessage.GetHashCode(), "{0}: Found an overlapping occurrence while processing message ID={1}. Cleaning things up and retrying", TraceContext.Get(), meetingMessage.Id);
                        StringBuilder stringBuilder = new StringBuilder(1024);
                        stringBuilder.AppendFormat("Found an overlapping occurrence while processing message ID={0}.", meetingMessage.Id);
                        if (ex.OccurrenceInfo == null)
                        {
                            CalendarAssistant.UnexpectedPathTracer.TraceError((long)this.GetHashCode(), "{0}: Unexpected: Handling OccurrenceCrossingBoundaryException, the OccurrenceInfo is null.", new object[]
                            {
                                TraceContext.Get()
                            });
                            stringBuilder.Append("Unexpected: Handling OccurrenceCrossingBoundaryException, the OccurrenceInfo is null.");
                        }
                        else
                        {
                            VersionedId versionedId = ex.OccurrenceInfo.VersionedId;
                            AggregateOperationResult aggregateOperationResult = meetingMessage.Session.Delete(DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                            {
                                versionedId
                            });
                            CalendarAssistant.ProcessingTracer.TraceDebug <object, OperationResult>((long)this.GetHashCode(), "{0}: Deleting the occurrence when handling an OccurrenceCrossingBoundaryException, returned:{1}", TraceContext.Get(), aggregateOperationResult.OperationResult);
                            stringBuilder.AppendFormat("Deleting the occurrence when handling an OccurrenceCrossingBoundaryException, returned: {0}", aggregateOperationResult.OperationResult);
                        }
                        CalendarAssistantLog.LogEntry(itemStore, ex, false, stringBuilder.ToString(), new object[0]);
                    }
                    catch (CorruptDataException ex2)
                    {
                        CalendarAssistant.ProcessingTracer.TraceDebug <object, CorruptDataException>((long)this.GetHashCode(), "{0}: Got a corrupt message, exception data:{1}", TraceContext.Get(), ex2);
                        CalendarAssistantLog.LogEntry(itemStore, ex2, false, "Got a corrupt message ID = {0}.", new object[]
                        {
                            meetingMessage.Id
                        });
                    }
                    finally
                    {
                        if (calendarItemBase != null)
                        {
                            calendarItemBase.Dispose();
                            calendarItemBase = null;
                        }
                    }
                    flag2 = true;
                }
                else if (item is MeetingInquiryMessage)
                {
                    MeetingInquiryMessage meetingInquiryMessage = (MeetingInquiryMessage)item;
                    try
                    {
                        this.calProcessor.ProcessMeetingInquiryMessage(this.cvsGateway, itemStore, meetingInquiryMessage);
                    }
                    catch (CalendarVersionStoreNotPopulatedException ex3)
                    {
                        CalendarAssistant.ProcessingTracer.TraceWarning <object, CalendarVersionStoreNotPopulatedException>((long)this.GetHashCode(), "{0}: Failed to process an inquiry message, because the CVS is not populated yet. {1}", TraceContext.Get(), ex3);
                        CalendarAssistantLog.LogEntry(itemStore, ex3, false, "Failed to process an inquiry message ID = {0}, because the CVS is not populated yet.", new object[]
                        {
                            meetingInquiryMessage.Id
                        });
                    }
                    this.calProcessor.OldMessageDeletion.DeleteMessage(itemStore, item);
                    flag2 = true;
                }
                else
                {
                    CalendarAssistant.UnexpectedPathTracer.TraceError((long)this.GetHashCode(), "{0}: Unexpected: Message class matched, but is not the correct object type. Ignoring message.", new object[]
                    {
                        TraceContext.Get()
                    });
                    CalendarAssistantLog.LogEntry(itemStore, "Unexpected: Message class matched, but is not the correct object type. Ignoring message ID = {0}.", new object[]
                    {
                        item.Id
                    });
                }
                if (flag2)
                {
                    TimeSpan timeSpan = DateTime.UtcNow.Subtract(utcNow);
                    CalendarAssistantPerformanceCounters.LastCalAssistantProcessingTime.RawValue = (long)timeSpan.TotalMilliseconds;
                    CalendarAssistantPerformanceCounters.AverageCalAssistantProcessingTime.IncrementBy((long)timeSpan.TotalMilliseconds);
                    CalendarAssistantPerformanceCounters.AverageCalAssistantProcessingTimeBase.Increment();
                    CalendarAssistantPerformanceCounters.MeetingMessagesProcessed.Increment();
                }
                CalendarAssistant.GeneralTracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Finished processing message. InternetMessgeID = {1}", TraceContext.Get(), text);
                CalendarAssistant.TracerPfd.TracePfd <int, object, string>((long)this.GetHashCode(), "PFD IWC {0} {1}: Finished processing message. InternetMessgeID = {2}", 21655, TraceContext.Get(), text);
            }
        }
 // Token: 0x060007B7 RID: 1975 RVA: 0x00037A84 File Offset: 0x00035C84
 private void HandleResponsesWithSameSequenceNumber(MailboxSession itemStore, MeetingMessage item, VersionedId iid, object[] rowProperties, string sentRepresenting, ref OldMessageDeletion.LatestItemInfo latestInfo, List <VersionedId> itemsToDelete, ref bool hasAttachments, ref bool hasBody)
 {
     if (!this.SentRepresentingMatches(sentRepresenting, rowProperties[5]))
     {
         return;
     }
     if (rowProperties[6] is PropertyError || !(rowProperties[6] is ExDateTime))
     {
         return;
     }
     if (rowProperties[7] is PropertyError || !(rowProperties[7] is bool) || (bool)rowProperties[7])
     {
         return;
     }
     try
     {
         using (MeetingResponse meetingResponse = MeetingResponse.Bind(item.Session, iid))
         {
             if (meetingResponse.Body.Size > 0L)
             {
                 return;
             }
         }
     }
     catch (VirusDetectedException e)
     {
         OldMessageDeletion.Tracer.TraceError <object, VersionedId>((long)this.GetHashCode(), "{0}: A virus was detected in the CalendarItem associated with this message {1}. This message will be skipped.", TraceContext.Get(), iid);
         CalendarAssistantLog.LogEntry(itemStore, e, false, "A virus was detected in the CalendarItem associated with this message {0}. This message will be skipped.", new object[]
         {
             iid
         });
         return;
     }
     catch (VirusMessageDeletedException e2)
     {
         OldMessageDeletion.Tracer.TraceError <object, VersionedId>((long)this.GetHashCode(), "{0}: A virus was detected in the CalendarItem associated with this message and was deleted {1}. This message will be skipped.", TraceContext.Get(), iid);
         CalendarAssistantLog.LogEntry(itemStore, e2, false, "A virus was detected in the CalendarItem associated with this message and was deleted {0}. This message will be skipped.", new object[]
         {
             iid
         });
         return;
     }
     catch (StoragePermanentException ex)
     {
         OldMessageDeletion.Tracer.TraceError <object, StoragePermanentException>((long)this.GetHashCode(), "{0}: Exception caught when opening response and getting the body: {1}", TraceContext.Get(), ex);
         CalendarAssistantLog.LogEntry(itemStore, ex, false, "Exception caught when opening response and getting the body for message id {0}", new object[]
         {
             iid
         });
         return;
     }
     catch (StorageTransientException ex2)
     {
         OldMessageDeletion.Tracer.TraceError <object, StorageTransientException>((long)this.GetHashCode(), "{0}: Exception caught when opening response and getting the body: {1}", TraceContext.Get(), ex2);
         CalendarAssistantLog.LogEntry(itemStore, ex2, false, "Exception caught when opening response and getting the body for message id {0}", new object[]
         {
             iid
         });
         return;
     }
     if (latestInfo.LatestClientSubmitTime < (ExDateTime)rowProperties[6])
     {
         if (!hasAttachments && !hasBody)
         {
             itemsToDelete.Add(latestInfo.LatestItemId);
             latestInfo.LatestItemId           = iid;
             latestInfo.LatestClientSubmitTime = (ExDateTime)rowProperties[6];
             hasAttachments = false;
             hasBody        = false;
             return;
         }
     }
     else
     {
         itemsToDelete.Add(iid);
     }
 }
        // Token: 0x060007B6 RID: 1974 RVA: 0x0003766C File Offset: 0x0003586C
        internal static void ApplyRollingHighlight(MeetingRequest meetingRequest, string internetMessageId, CalendarItemBase originalCalItem, OldMessageDeletion.LatestItemInfo latestInfo)
        {
            int            i = 3;
            MeetingRequest meetingRequest2 = meetingRequest;

            CalendarAssistant.TracerPfd.TracePfd <int, object, string>(0L, "PFD IWC {0} {1} Applying the rolling highlight to the item{2}", 18583, TraceContext.Get(), internetMessageId);
            if (meetingRequest2 != null)
            {
                int hashCode = meetingRequest.GetHashCode();
                PropertyDefinition changeHighlight = CalendarItemBaseSchema.ChangeHighlight;
                while (i > 0)
                {
                    try
                    {
                        if (meetingRequest2 == null)
                        {
                            meetingRequest2 = MeetingRequest.Bind(meetingRequest.Session, meetingRequest.Id);
                            meetingRequest2.OpenAsReadWrite();
                        }
                        if (latestInfo.RollingHighlight != 0)
                        {
                            int num = (int)Utils.SafeGetProperty(meetingRequest2, changeHighlight, 0);
                            if ((num & 8) == 0 && (latestInfo.RollingHighlight & 8) != 0)
                            {
                                if (!string.IsNullOrEmpty(latestInfo.LatestOldLocationStr))
                                {
                                    meetingRequest2[CalendarItemBaseSchema.OldLocation] = latestInfo.LatestOldLocationStr;
                                }
                                else
                                {
                                    latestInfo.RollingHighlight &= -9;
                                }
                            }
                            if ((num & 3) == 0 && (latestInfo.RollingHighlight & 3) != 0)
                            {
                                if (latestInfo.LatestOldStartTime != ExDateTime.MinValue && latestInfo.LatestOldEndTime != ExDateTime.MinValue)
                                {
                                    meetingRequest2[MeetingRequestSchema.OldStartWhole] = latestInfo.LatestOldStartTime;
                                    meetingRequest2[MeetingRequestSchema.OldEndWhole]   = latestInfo.LatestOldEndTime;
                                }
                                else
                                {
                                    latestInfo.RollingHighlight &= -4;
                                }
                            }
                            num |= latestInfo.RollingHighlight;
                            meetingRequest2[changeHighlight] = num;
                            if (meetingRequest2.MeetingRequestType != MeetingMessageType.PrincipalWantsCopy)
                            {
                                ChangeHighlightHelper changeHighlightHelper = new ChangeHighlightHelper(num);
                                MeetingMessageType    suggestedMeetingType  = changeHighlightHelper.SuggestedMeetingType;
                                meetingRequest2.MeetingRequestType = suggestedMeetingType;
                            }
                        }
                        if (originalCalItem != null && meetingRequest2.MeetingRequestType != MeetingMessageType.NewMeetingRequest && meetingRequest2.MeetingRequestType != MeetingMessageType.PrincipalWantsCopy)
                        {
                            ResponseType responseType = originalCalItem.ResponseType;
                            if (responseType == ResponseType.NotResponded || responseType == ResponseType.None)
                            {
                                meetingRequest2.MeetingRequestType    = MeetingMessageType.FullUpdate;
                                meetingRequest2[ItemSchema.IconIndex] = CalendarItemBase.CalculateMeetingRequestIcon(meetingRequest2);
                            }
                        }
                        if (!meetingRequest2.IsDirty)
                        {
                            break;
                        }
                        ConflictResolutionResult saveResults = meetingRequest2.Save(SaveMode.ResolveConflicts);
                        meetingRequest2.Load();
                        if (CalendarProcessing.CheckSaveResults(meetingRequest2, saveResults, internetMessageId))
                        {
                            break;
                        }
                        i--;
                        if (meetingRequest2 != meetingRequest && meetingRequest2 != null)
                        {
                            meetingRequest2.Dispose();
                        }
                        meetingRequest2 = null;
                    }
                    catch (ObjectExistedException ex)
                    {
                        MailboxSession session = meetingRequest.Session as MailboxSession;
                        OldMessageDeletion.Tracer.TraceError((long)hashCode, "{0}: Exception thrown when rolling forward the change highlight on item: {1}, attempt: {2}, exception = {3}", new object[]
                        {
                            TraceContext.Get(),
                            internetMessageId,
                            4 - i,
                            ex
                        });
                        CalendarAssistantLog.LogEntry(session, ex, false, "Exception thrown when rolling forward the change highlight on item: {0}, attempt: {1}", new object[]
                        {
                            internetMessageId,
                            4 - i
                        });
                        i--;
                        if (meetingRequest2 != meetingRequest && meetingRequest2 != null)
                        {
                            meetingRequest2.Dispose();
                            meetingRequest2 = null;
                        }
                    }
                    catch (SaveConflictException ex2)
                    {
                        MailboxSession session2 = meetingRequest.Session as MailboxSession;
                        OldMessageDeletion.Tracer.TraceError((long)hashCode, "{0}: Exception thrown when rolling forward the change highlight on item: {1}, attempt: {2}, exception = {3}", new object[]
                        {
                            TraceContext.Get(),
                            internetMessageId,
                            4 - i,
                            ex2
                        });
                        CalendarAssistantLog.LogEntry(session2, ex2, false, "Exception thrown when rolling forward the change highlight on item: {0}, attempt: {1}", new object[]
                        {
                            internetMessageId,
                            4 - i
                        });
                        i--;
                        if (meetingRequest2 != meetingRequest && meetingRequest2 != null)
                        {
                            meetingRequest2.Dispose();
                            meetingRequest2 = null;
                        }
                    }
                    catch (ObjectNotFoundException ex3)
                    {
                        MailboxSession session3 = meetingRequest.Session as MailboxSession;
                        OldMessageDeletion.Tracer.TraceError((long)hashCode, "{0}: Exception thrown when rolling forward the change highlight on item: {1},  attempt: {2}, exception = {3}", new object[]
                        {
                            TraceContext.Get(),
                            internetMessageId,
                            4 - i,
                            ex3
                        });
                        CalendarAssistantLog.LogEntry(session3, ex3, false, "Exception thrown when rolling forward the change highlight on item: {0}, attempt: {1}", new object[]
                        {
                            internetMessageId,
                            4 - i
                        });
                        break;
                    }
                    finally
                    {
                        if (meetingRequest2 != meetingRequest && meetingRequest2 != null)
                        {
                            meetingRequest2.Dispose();
                        }
                    }
                }
            }
        }
        // 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;
            }
        }