public function getParent()
    {
        $section = $this->getSection();
        if ($this->hasMainSection()) {
            if ($section->isRoot()) {
                return null;
            } elseif ($section->getParent() instanceof Section) {
                return $section->getParent()->getPage();
            } else {
                return null;
            }
        }

        return $section->getPage();
    }