public function endCronSchedule($status, $messages = null)
    {
        if ($this->id) {
            $this->dateFinished = Yii::$app->formatter->asDatetime(time(), 'php: Y-m-d H:i:s');
            $this->status = $status;
            $this->messages = $messages;

            return $this->save();
        }

        return false;
    }