public function findByViewReferences(array $viewReferences)
    {
        $pageIds = [];
        foreach ($viewReferences as $viewReference) {
            if ($viewReference instanceof BusinessPageReference) {
                $pageIds[] = $viewReference->getTemplateId();
            } else {
                $pageIds[] = $viewReference->getViewId();
            }
        }

        $qb = $this->getInstance();
        $qb->andWhere($this->mainAlias.'.id IN (:pageIds)')
            ->setParameter('pageIds', $pageIds);

        $pages = $qb->getQuery()->getResult();

        foreach ($pages as $page) {
            $pageId = $page->getId();
            $viewReference = array_filter(
                $viewReferences,
                function ($e) use ($pageId) {
                    return $e->getViewId() == $pageId;
                });
            if (!empty($viewReference[0])) {
                $page->setCurrentLocale($viewReference[0]->getLocale());
            }
        }

        return $pages;
    }