protected function repairShadowNodes($workspaceName, /** @noinspection PhpUnusedParameterInspection */$dryRun, NodeType $nodeType = null)
    {
        /** @var Workspace $workspace */
        $workspace = $this->workspaceRepository->findByIdentifier($workspaceName);
        if ($workspace->getBaseWorkspace() === null) {
            $this->dispatch(self::EVENT_NOTICE, sprintf('Repairing base workspace "<i>%s</i>", therefore skipping check for shadow nodes.', $workspaceName));
            return;
        }

        $this->dispatch(self::EVENT_NOTICE, 'Checking for nodes with missing shadow nodes ...');
        $newShadowNodes = $this->findMissingShadowNodesInWorkspace($workspace, $nodeType);
        if ($newShadowNodes === []) {
            return;
        }
        $numberOfNewShadowNodes = count($newShadowNodes);

        $taskDescription = sprintf('Add <i>%d</i> missing shadow node%s', $numberOfNewShadowNodes, $numberOfNewShadowNodes > 1 ? 's' : '');
        $taskClosure = function () use ($newShadowNodes) {
            /** @var NodeData $nodeData */
            foreach ($newShadowNodes as list('nodeData' => $nodeData, 'shadowPath' => $shadowPath)) {
                $nodeData->createShadow($shadowPath);
            }
            $this->persistenceManager->persistAll();
        };
        $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure);
    }