protected function saveState(): self
    {
        foreach ($this->queue as $key => $job) {
            $this->db->selectCollection($this->scheduler->getJobQueue())->updateOne(
                ['_id' => $job['_id'], '$isolated' => true],
                ['$setOnInsert' => $job],
                ['upsert' => true]
            );
        }

        return $this;
    }