public function findOneClosestPageIdWithActiveTemplateByRootLine(array $rootLine)
    {
        $rootLinePageIds = [0];
        foreach ($rootLine as $rootLineItem) {
            $rootLinePageIds[] = (int)$rootLineItem['uid'];
        }

        $queryBuilder = $this->getQueryBuilder();

        $result = $queryBuilder
            ->select('uid', 'pid')
            ->from($this->table)
            ->where($queryBuilder->expr()->in('pid', $rootLinePageIds))
            ->execute()->fetch();

        return isset($result['pid']) ? $result['pid'] : 0;
    }