protected virtual void Execute(DeleteScheduleContext context)
        {
            if (!string.IsNullOrEmpty(context.Schedule.ID) && !(context.Schedule.ID == ID.Null.ToString()))
             {
            Item schedule = context.Schedule.GetTargetItem();

            if (schedule != null)
            {
               if (context.DeleteSeries)
               {
                  var links = Globals.LinkDatabase.GetReferrers(schedule);

                  Item source = null;
                  foreach (var link in links)
                  {
                     source = link.GetSourceItem();
                     source.Delete();

                     PublishUtil.Publishing(source, false, false);
                  }
               }

               if (Globals.LinkDatabase.GetReferrerCount(schedule) == 0)
               {
                  schedule.Delete();
                  PublishUtil.Publishing(schedule, false, false);
               }
            }
             }
        }
        public static void DeleteScheduler(Schedule schedule, bool deleteSeries)
        {
            Message message = Message.Parse(schedule, "schedule:delete");

             var scheduleContext = new DeleteScheduleContext(schedule, deleteSeries);
             Dispatcher.Dispatch(message, scheduleContext);
        }