public function getRootPageId($pageId = 0, $forceFallback = false, $mountPointIdentifier = '')
    {
        /** @var Rootline $rootLine */
        $rootLine = GeneralUtility::makeInstance(Rootline::class);
        $rootPageId = intval($pageId) ?: intval($GLOBALS['TSFE']->id);

        // frontend
        if (!empty($GLOBALS['TSFE']->rootLine)) {
            $rootLine->setRootLineArray($GLOBALS['TSFE']->rootLine);
        }

        // fallback, backend
        if ($pageId != 0 && ($forceFallback || !$rootLine->getHasRootPage())) {
            /* @var $pageSelect PageRepository */
            $pageSelect = GeneralUtility::makeInstance(PageRepository::class);

            try {
                $rootLineArray = $pageSelect->getRootLine($pageId, $mountPointIdentifier);
            } catch (\RuntimeException $e) {
                $rootLineArray = [];
            }
            $rootLine->setRootLineArray($rootLineArray);
        }

        $rootPageFromRootLine = $rootLine->getRootPageId();

        return $rootPageFromRootLine === 0 ? $rootPageId : $rootPageFromRootLine;
    }