public static function installAvooDemoBundle(InputInterface $input, OutputInterface $output, QuestionHelper $helper)
    {
        $rootDir = getcwd();

        if (file_exists($rootDir.'/src/Avoo/DemoBundle')) {
            return;
        }
        if (!getenv('AVOO_DEMO')) {
            $question = new ConfirmationQuestion('Would you like to install Avoo Demo bundle? [y/n] ', true);
            if (!$helper->ask($input, $output, $question)) {
                return;
            }
        }

        $output->writeln('<info>Installing the Avoo Demo bundle.</info>');
        $output->writeln('');

        $kernelFile = $rootDir . '/app/AppKernel.php';
        $configFile = $rootDir . '/app/config/config_dev.yml';

        $fileSystem = new Filesystem();
        $fileSystem->mirror(__DIR__.'/../Resources/skeleton/avoo-demo-bundle', $rootDir . '/src', null, array('override' => true));

        $ref = '$bundles[] = new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();';
        $bundleDeclaration = "\$bundles[] = new \\Avoo\\DemoBundle\\AvooDemoBundle();";
        $content = file_get_contents($kernelFile);

        if (false === strpos($content, $bundleDeclaration)) {
            $updatedContent = str_replace($ref, $bundleDeclaration."\n            ".$ref, $content);
            if ($content === $updatedContent) {
                throw new \RuntimeException('Unable to patch %s.', $kernelFile);
            }

            $fileSystem->dumpFile($kernelFile, $updatedContent);
        }

        $ref = '- { resource: config.yml }';
        $configDeclaration = '- { resource: @AvooDemoBundle/Resources/config/config.yml }';
        $content = file_get_contents($configFile);

        if (false === strpos($content, $bundleDeclaration)) {
            $updatedContent = str_replace($ref, $ref . "\n    " . $configDeclaration, $content);
            if ($content === $updatedContent) {
                throw new \RuntimeException('Unable to patch %s.', $kernelFile);
            }

            $fileSystem->dumpFile($configFile, $updatedContent);
        }

        self::patchAvooDemoBundleConfiguration($rootDir, $fileSystem);
    }