private function loadConfig()
    {
        $appBundle = null;
        $this->getEventManager()->dispatch(self::EVENT_BEFORE_LOAD_CONFIG, $this);

        foreach ($this->registerBundles() as $bundle) {
            if ($bundle instanceof \App\AppBundle) {
                $appBundle = $bundle;
                continue;
            }

            $bundle->loadConfig();
        }

        if (!$appBundle instanceof \App\AppBundle) {
            throw new BaseException('AppBundle does not exist.');
        }

        $appBundle->loadConfig();
        $this->getEventManager()->dispatch(self::EVENT_AFTER_LOAD_CONFIG, $this);
    }