public function getNextBuildTime()
    {
        $nextBuildTime = null;
        $build = null;
        while ($this->builds->valid()) {
            $build = $this->builds->current();
            if ($build->getNextBuildTime() <= $nextBuildTime
               || $nextBuildTime === null) {
                if ($build->getStatus() != BuildInterface::STOPPED) {
                    $buildTime = $build->getNextBuildTime();

                    if ($buildTime !== null && !$build->isQueued()) {
                        $nextBuildTime = $buildTime;
                        /*
                         * Need to write to queue here and have a FIFO
                         * check before if not already in queue
                         */
                        //if (!in_array($build, $this->_queue)) {
                            $this->queue[] = $build;
                        $build->enqueue();
                        //}
                    } else {
                        /*
                         * we need to check if a scheduled build has a lower build time
                         * but we dont want to queue it again
                         */
                        $nextBuildTime = $buildTime;
                    }
                }
            }
            $this->builds->next();
        }
        usort($this->queue, array($this, 'sortQueue'));
        $this->builds->rewind();

        return $nextBuildTime;
    }