public function loadConfiguration()
    {
        /** @var ConfigLoaderRepository $repository */
        $repository = $this->loadEnvironment();

        $cache = $repository->fetchConfig();
        if (! empty($cache)) {
            return $cache;
        }

        $config = [];

        // Fetch all groups, and fetch the config for each group based on the
        // environment and website ID of the current site.
        foreach ($repository->fetchAllGroups() as $group) {
            $groupConfig = ConfigModel::fetchSettings(
                $repository->getEnvironment(),
                $repository->getWebsiteId(),
                $group
            );
            $config[$group] = $groupConfig;
        }

        $repository->storeConfig($config);
        return $config;
    }