public function registerModulesByCategories(array $modules)
    {
        $count = 0;
        foreach($modules as $categoryModules) {
            if (is_array($categoryModules)) {
                $count += $this->registerModules($categoryModules);
            } else {
                throw new \common_exception_InvalidArgumentType(self::class, __FUNCTION__, 0, 'array', $categoryModules);
            }
        }
        return $count;
    }