public function runSchedule()
    {
        if ($this->getScheduler()->isEmpty()) {
            return;
        }

        if (!$this->getScheduler()->top()->isDue()) {
            // Nothing to do.
            return;
        }

        $schedule = $this->getScheduler()->extract();

        $this->getLogger()->debug('Running schedule '.$schedule->getName().' with expression: '.$schedule->getExpression().'.');
        $schedule->run();

        $this->getScheduler()->insert($schedule);
    }