public function deletePage(Page $page)
    {
        if ($page->hasMainSection()) {
            $this->getEntityManager()
                    ->getRepository('BackBee\NestedNode\Section')
                    ->deleteSection($page->getSection());
        }

        if (null !== $page->getContentSet()) {
            $this->getEntityManager()
                    ->createQueryBuilder()
                    ->update('BackBee\NestedNode\\Page', 'p')
                    ->set('p._contentset', ':null')
                    ->where('p._contentset = :uid')
                    ->setParameter('uid', $page->getContentSet()->getUid())
                    ->setParameter('null', null)
                    ->getQuery()
                    ->execute();

            $this->getEntityManager()
                    ->getRepository('BackBee\ClassContent\AbstractClassContent')
                    ->deleteContent($page->getContentSet());
        }

        $this->getEntityManager()
                ->createQueryBuilder()
                ->update('BackBee\ClassContent\AbstractClassContent', 'c')
                ->set('c._mainnode', ':null')
                ->where('c._mainnode = :uid')
                ->setParameter('uid', $page->getUid())
                ->setParameter('null', null)
                ->getQuery()
                ->execute();

        $this->getEntityManager()->remove($page);
    }