public function setPlatformState(MaintenanceState $state)
    {
        if ($previous = $this->getDriver()->get(self::PREFIX . self::LAST_MODE)) {
            $currentState = new MaintenanceState(json_decode($previous, true));
            $currentState->setEndTime($state->getStartTime());
            $this->getDriver()->set(self::PREFIX . $currentState->getId(), json_encode($currentState->toArray()));

            $state->setId($currentState->getId() + 1);
        }


        $this->getDriver()->set(self::PREFIX . self::LAST_MODE, json_encode($state->toArray()));
    }