private static function deactivate($extension, ReportingChain $chain)
    {
        if ($extension['is_active'] == 1) {
            ExtensionDataHelper::prepareMigrationTask(
                $extension,
                $chain,
                ExtensionsManager::MIGRATE_TYPE_DOWN,
                ExtensionsManager::EXTENSION_DEACTIVATE_DEFERRED_GROUP
            );
            $deactivationTask = ExtensionDataHelper::buildTask(
                [
                    realpath(Yii::getAlias('@app') . '/yii'),
                    'extension/deactivate',
                    $extension['composer_name'],
                ],
                ExtensionsManager::EXTENSION_DEACTIVATE_DEFERRED_GROUP
            );
            $chain->addTask($deactivationTask);
        } else {
            $dummyTask = ExtensionDataHelper::buildTask(
                [
                    realpath(Yii::getAlias('@app') . '/yii'),
                    'extension/dummy',
                    'Extension already deactivated!',
                ],
                ExtensionsManager::EXTENSION_DUMMY_DEFERRED_GROUP
            );
            $chain->addTask($dummyTask);
        }
    }