public function ensureRootNodeExists()
{
try {
$this->getRootNode();
} catch (RootNodeNotFoundException $e) {
/**
* @var AbstractCategory
*/
$rootNode = new $this->entityClass();
$rootNode->setName('Root Category');
$this->entityManager->persist($rootNode);
$this->entityManager->flush();
}
}