// Token: 0x06000173 RID: 371 RVA: 0x0000D008 File Offset: 0x0000B208
        internal static bool CancelCalendarItem(UserContext userContext, CalendarItemBase calendarItemBase, EditCalendarItemHelper.CancelRangeType cancelRange, ExDateTime cancelFromDateTime, out InfobarMessage infobarMessage)
        {
            bool result = true;

            infobarMessage = null;
            CalendarItem calendarItem = calendarItemBase as CalendarItem;

            try
            {
                if (calendarItem == null)
                {
                    StoreObjectId masterStoreObjectId = CalendarUtilities.GetMasterStoreObjectId(calendarItemBase);
                    calendarItem = Utilities.GetItem <CalendarItem>(userContext, masterStoreObjectId, new PropertyDefinition[0]);
                    if (calendarItem != null)
                    {
                        calendarItem.OpenAsReadWrite();
                    }
                }
                if (cancelRange == EditCalendarItemHelper.CancelRangeType.Occurrence || cancelRange == EditCalendarItemHelper.CancelRangeType.None)
                {
                    EditCalendarItemHelper.CancelCalendarItem(userContext, calendarItemBase);
                }
                else if (cancelRange == EditCalendarItemHelper.CancelRangeType.All)
                {
                    EditCalendarItemHelper.CancelCalendarItem(userContext, calendarItem);
                }
                else if (cancelRange == EditCalendarItemHelper.CancelRangeType.FromDate)
                {
                    int cancelRecurrenceCount = CalendarItemUtilities.GetCancelRecurrenceCount(calendarItem, cancelFromDateTime);
                    if (cancelRecurrenceCount == 0)
                    {
                        EditCalendarItemHelper.CancelCalendarItem(userContext, calendarItem);
                    }
                    else if (cancelRecurrenceCount > 0)
                    {
                        calendarItem.Recurrence = new Recurrence(calendarItem.Recurrence.Pattern, new EndDateRecurrenceRange(calendarItem.Recurrence.Range.StartDate, cancelFromDateTime.IncrementDays(-1)));
                        if (calendarItem.IsMeeting && calendarItem.MeetingRequestWasSent)
                        {
                            result = CalendarUtilities.SendMeetingMessages(userContext, calendarItem, true, out infobarMessage);
                        }
                        else
                        {
                            result = CalendarUtilities.SaveCalendarItem(calendarItem, userContext, out infobarMessage);
                        }
                    }
                }
            }
            finally
            {
                if (calendarItem != null && calendarItem != calendarItemBase)
                {
                    calendarItem.Dispose();
                }
            }
            return(result);
        }