private function getDomainLookupQuery($domain = null)
    {
        /** @var \Doctrine\ORM\QueryBuilder $queryBuilder */
        $queryBuilder = $this->_em->createQueryBuilder();

        $queryBuilder->select(
            'domain.domain,
            primary.domain primaryDomain,
            language.iso639_2b languageId,
            site.siteId,
            country.iso3 countryId'
        )
            ->from(\Rcm\Entity\Domain::class, 'domain', 'domain.domain')
            ->leftJoin('domain.primaryDomain', 'primary')
            ->leftJoin('domain.defaultLanguage', 'language')
            ->leftJoin(
                \Rcm\Entity\Site::class,
                'site',
                Join::WITH,
                'site.domain = domain.domainId'
            )
            ->leftJoin('site.country', 'country');

        if (!empty($domain)) {
            $queryBuilder->andWhere('domain.domain = :domain')
                ->setParameter('domain', $domain);
        }

        return $queryBuilder->getQuery();
    }