protected function calculateDocumentIdentifier(NodeInterface $node, $targetWorkspaceName = null): string
    {
        $contextPath = $node->getContextPath();

        if ($targetWorkspaceName !== null) {
            $contextPath = str_replace($node->getContext()->getWorkspace()->getName(), $targetWorkspaceName, $contextPath);
        }

        return sha1($contextPath);
    }