public static function save_pending_events($event_id)
 {
     if (wp_get_post_parent_id($event_id) != 0) {
         return;
     }
     $next_pending = get_post_meta($event_id, '_EventNextPendingRecurrence', true);
     if (empty($next_pending)) {
         return;
     }
     $recurrence = self::getRecurrenceForEvent($event_id);
     $recurrence->setMinDate(strtotime($next_pending));
     $recurrence->setMaxDate(strtotime(self::$scheduler->get_latest_date()));
     $dates = (array) $recurrence->getDates();
     if (empty($dates)) {
         return;
         // nothing to add right now. try again later
     }
     delete_post_meta($event_id, '_EventNextPendingRecurrence');
     if ($recurrence->constrainedByMaxDate() !== false) {
         update_post_meta($event_id, '_EventNextPendingRecurrence', date(DateSeriesRules::DATE_FORMAT, $recurrence->constrainedByMaxDate()));
     }
     $excluded = array_map('strtotime', self::get_excluded_dates($event_id));
     foreach ($dates as $date) {
         if (!in_array($date, $excluded)) {
             $instance = new TribeEventsPro_RecurrenceInstance($event_id, $date);
             $instance->save();
         }
     }
 }
 public static function save_pending_events($event_id)
 {
     $next_pending = get_post_meta($event_id, '_EventNextPendingRecurrence', TRUE);
     if (empty($next_pending)) {
         return;
     }
     $recurrence = self::getRecurrenceForEvent($event_id);
     $recurrence->setMinDate(strtotime($next_pending));
     $recurrence->setMaxDate(strtotime(self::$scheduler->get_latest_date()));
     $dates = (array) $recurrence->getDates();
     if (empty($dates)) {
         return;
         // nothing to add right now. try again later
     }
     delete_post_meta($event_id, '_EventNextPendingRecurrence');
     if ($recurrence->constrainedByMaxDate() !== FALSE) {
         add_post_meta($event_id, '_EventNextPendingRecurrence', date(DateSeriesRules::DATE_FORMAT, $recurrence->constrainedByMaxDate()));
     }
     foreach ($dates as $date) {
         add_post_meta($event_id, '_EventStartDate', date(DateSeriesRules::DATE_FORMAT, $date));
     }
 }