protected function register($environment)
    {
        if (isset($this->environmentsBundles[$environment])) {
            foreach ($this->environmentsBundles[$environment] as $bundle) {
                $bundleClass = $bundle->getClass();
                if (empty($this->instantiatedBundles) || !in_array($bundleClass, $this->instantiatedBundles)) {

                    if ( ! class_exists($bundleClass)) {
                        throw new InvalidAutoloaderException(sprintf("The bundle class %s does not exist. Check the bundle's autoload.json to fix the problem", $bundleClass, get_class($this)));
                    }

                    if ( ! in_array($bundle->getName(), $this->bundles)) {
                        $instantiatedBundle = new $bundleClass;
                        $this->bundles[$bundle->getName()] = $instantiatedBundle;
                        $overridedBundles = $bundle->getOverrides();
                        if ( ! empty($overridedBundles)) {
                            $this->overridedBundles[$bundle->getName()] = $overridedBundles;
                        }
                        $this->instantiatedBundles[] = $bundleClass;
                    }
                }
            }
        }
    }