public static function updateConfig()
    {
        /** @var ExtensionsManager $module */
        $module = ExtensionsManager::module();
        $extensions = $module->getExtensions();
        $installed = ComposerInstalledSet::get(true)->getInstalled();
        $fileName = Yii::getAlias($module->extensionsStorage);
        $writer = new ApplicationConfigWriter(['filename' => $fileName]);
        $config = self::rebuldConfig($installed);
        if (false === empty($extensions)) {
            $toAdd = array_udiff($config, $extensions, [self::className(), 'arraysCompareCallback']);
            $toRemove = array_udiff($extensions, $config, [self::className(), 'arraysCompareCallback']);
            foreach ($toRemove as $name => $ext) {
                if (true === isset($extensions[$name])) {
                    unset($extensions[$name]);
                }
            }
            $config = array_merge($extensions, $toAdd);
        }
        $writer->addValues($config);
        return $writer->commit();
    }