public function getAvailableSites($stopOnInvalidSite = false)
    {
        $sites = [];
        $cacheId = 'SiteRepository' . '_' . 'getAvailableSites';

        $methodResult = $this->runtimeCache->get($cacheId);
        if (!empty($methodResult)) {
            return $methodResult;
        }

        $servers = $this->getSolrServersFromRegistry();
        foreach ($servers as $server) {
            if (isset($sites[$server['rootPageUid']])) {
                //get each site only once
                continue;
            }

            try {
                $sites[$server['rootPageUid']] = $this->buildSite($server['rootPageUid']);
            } catch (\InvalidArgumentException $e) {
                if ($stopOnInvalidSite) {
                    throw $e;
                }
            }
        }

        $methodResult = $sites;
        $this->runtimeCache->set($cacheId, $methodResult);

        return $methodResult;
    }