private function generatePageEntity()
    {
        list($entityCode, $entityPath) = $this->generateEntity(
            $this->bundle,
            $this->entity,
            $this->fields,
            'Pages',
            $this->prefix,
            'Kunstmaan\NodeBundle\Entity\AbstractPage'
        );

        // Add implements HasPageTemplateInterface
        $search = 'extends \Kunstmaan\NodeBundle\Entity\AbstractPage';
        $entityCode = str_replace(
            $search,
            $search . ' implements \Kunstmaan\PagePartBundle\Helper\HasPageTemplateInterface',
            $entityCode
        );

        // Add some extra functions in the generated entity :s
        $params = array(
            'bundle' => $this->bundle->getName(),
            'page' => $this->entity,
            'template' => substr($this->template, 0, strpos($this->template, '.')),
            'sections' => array_map(
                function ($val) {
                    return substr($val, 0, strpos($val, '.'));
                },
                $this->sections
            ),
            'adminType' => '\\' . $this->bundle->getNamespace() . '\\Form\\Pages\\' . $this->entity . 'AdminType',
            'namespace' => $this->registry->getAliasNamespace($this->bundle->getName()) . '\\Pages\\' . $this->entity,
            'isV4' => $this->isSymfony4(),
        );
        $extraCode = $this->render('/Entity/Pages/ExtraFunctions.php', $params);

        $pos = strrpos($entityCode, "\n}");
        $trimmed = substr($entityCode, 0, $pos);
        $entityCode = $trimmed."\n\n".$extraCode."\n}\n";

        // Write class to filesystem
        $this->filesystem->mkdir(dirname($entityPath));
        file_put_contents($entityPath, $entityCode);

        $this->assistant->writeLine('Generating entity : <info>OK</info>');
    }