private function getName(
        AutoNameBehavior $document,
        NodeInterface $parentNode,
        $autoRename = true,
        NodeInterface $node = null
    ) {
        $title = $document->getTitle();

        if (!$title) {
            throw new DocumentManagerException(
                sprintf(
                    'Document has no title (title is required for auto name behavior): %s)',
                    DocumentHelper::getDebugTitle($document)
                )
            );
        }

        $name = $this->slugifier->slugify($title);

        return $this->resolver->resolveName($parentNode, $name, $node, $autoRename);
    }