private function setWorkflowStage(
        WorkflowStageBehavior $document,
        DocumentAccessor $accessor,
        $workflowStage,
        $locale,
        $live
    ) {
        $path = $this->documentInspector->getPath($document);
        $document->setWorkflowStage($workflowStage);

        $publishDate = $document->getPublished();

        if (!$publishDate && WorkflowStage::PUBLISHED === $workflowStage) {
            $publishDate = new \DateTime();
            $accessor->set(self::PUBLISHED_FIELD, $publishDate);
        }

        $defaultNode = $this->defaultSession->getNode($path);
        $this->setWorkflowStageOnNode($defaultNode, $locale, $workflowStage, $publishDate);

        if ($live) {
            $liveNode = $this->liveSession->getNode($path);
            $this->setWorkflowStageOnNode($liveNode, $locale, $workflowStage, $publishDate);
        }
    }