public static function runTask($command, $groupName, $immediate = false)
    {
        $task = ExtensionDataHelper::buildTask($command, $groupName);
        if ($task->registerTask()) {
            if ($immediate) {
                DeferredHelper::runImmediateTask($task->model()->id);
            }
        } else {
            throw new ServerErrorHttpException("Unable to start task");
        }
    }