public function registerModules(array $modules)
    {
        $count = 0;
        foreach($modules as $module) {
            if (is_array($module)) {
                $module = $this->createFromArray($module);
            }
            $this->registry->register($module);
            $count ++;
        }
        return $count;
    }