protected function printStages(Application $application, array $stages, array $tasks)
    {
        foreach ($stages as $stage) {
            $this->output->writeln('      <comment>' . $stage . ':</comment>');
            foreach (['before', 'tasks', 'after'] as $stageStep) {
                $output = '';
                foreach (['_', $application->getName()] as $applicationName) {
                    $label = $applicationName === '_' ? 'for all applications' : 'for application ' . $applicationName;
                    if (isset($tasks['stage'][$applicationName][$stage][$stageStep])) {
                        foreach ($tasks['stage'][$applicationName][$stage][$stageStep] as $task) {
                            $this->printBeforeAfterTasks($tasks, $applicationName, $task, 'before', $output);
                            $output .= '          <success>' . $task . '</success> <info>(' . $label . ')</info>' . PHP_EOL;
                            $this->printBeforeAfterTasks($tasks, $applicationName, $task, 'after', $output);
                        }
                    }
                }

                if (strlen($output) > 0) {
                    $this->output->writeln('        <info>' . $stageStep . ':</info>');
                }
                $this->output->write($output);
            }
        }
    }