/// <summary>
        /// Applies the appropiate rule to the meeting parameter
        /// </summary>
        /// <param name="meetingItem">The meeting that needs processing</param>
        /// <param name="rule">the associated decline rule for the folder of this meetingItem</param>
        private static void ProcessRule(MeetingItem meetingItem, DeclineRuleSetting rule)
        {
            // if it's a Cancelation, delete it from calendar
            if (meetingItem.Class == OlObjectClass.olMeetingCancellation)
            {
                if (meetingItem.GetAssociatedAppointment(false) != null)
                {
                    meetingItem.GetAssociatedAppointment(false).Delete(); return;
                }
                meetingItem.Delete(); return; // if deleted by user/app, delete the whole message
            }

            // get associated appointment
            AppointmentItem appointment         = meetingItem.GetAssociatedAppointment(false);
            string          globalAppointmentID = appointment.GlobalAppointmentID;

            // optional, send notification back to sender
            appointment.ResponseRequested &= rule.SendResponse;

            // set decline to the meeting
            MeetingItem responseMeeting = appointment.Respond(rule.Response, true);

            // https://msdn.microsoft.com/en-us/VBA/Outlook-VBA/articles/appointmentitem-respond-method-outlook
            // says that Respond() will return a new meeting object for Tentative response

            // optional, add a meesage to the Body
            if (!String.IsNullOrEmpty(rule.Message))
            {
                (responseMeeting ?? meetingItem).Body = rule.Message;
            }

            // send decline
            //if(rule.Response == OlMeetingResponse.olMeetingDeclined)
            (responseMeeting ?? meetingItem).Send();

            // and delete the appointment if tentative
            if (rule.Response == OlMeetingResponse.olMeetingTentative)
            {
                appointment.Delete();
            }

            // after Sending the response, sometimes the appointment doesn't get deleted from calendar,
            // but appointmnent could become and invalid object, so we need to search for it and delete it
            AppointmentItem newAppointment = (AppointmentItem)Globals.AddIn.Application.Session.GetDefaultFolder(OlDefaultFolders.olFolderCalendar).Items
                                             .Find("@SQL=\"http://schemas.microsoft.com/mapi/id/{6ED8DA90-450B-101B-98DA-00AA003F1305}/00030102\" = '"
                                                   + globalAppointmentID + "' ");

            if (newAppointment != null)
            {
                newAppointment.Delete();
            }
        }