private function createNode(NodeInterface $node, $pathSegment, $uuid)
    {
        if ($node->hasNode($pathSegment)) {
            return $node->getNode($pathSegment);
        }

        $node = $node->addNode($pathSegment);
        $node->addMixin('mix:referenceable');
        $node->setProperty('jcr:uuid', $uuid);

        return $node;
    }