public CommandCollection BuildCommands()
        {
            if (_instanceConfiguration.Verbose)
            {
                _loggingConfiguration.SetLogLevelToDebug();
            }

            var commandCollection = _kernel.GetService <CommandCollection>();

            if (_instanceConfiguration.ShowState)
            {
                commandCollection.Add(_kernel.GetService <ShowStateCommand>());
                return(commandCollection);
            }

            if (!string.IsNullOrWhiteSpace(_instanceConfiguration.SetConfigurationValue))
            {
                commandCollection.Add(_kernel.GetService <ConfigureCommand>());
                return(commandCollection);
            }

            if (_instanceConfiguration.Update)
            {
                if (string.IsNullOrEmpty(_instanceConfiguration.Environment))
                {
                    commandCollection.Add(_kernel.GetService <HelpCommand>());
                }
                else
                {
                    commandCollection.Add(_kernel.GetService <UpdateCommand>());
                }
                return(commandCollection);
            }

            if (_instanceConfiguration.Help ||
                string.IsNullOrWhiteSpace(_instanceConfiguration.AppName))
            {
                commandCollection.Add(_kernel.GetService <HelpCommand>());
                return(commandCollection);
            }

            if (!_instanceConfiguration.Install && !_instanceConfiguration.Prep)
            {
                if (string.IsNullOrEmpty(_instanceConfiguration.Environment))
                {
                    commandCollection.Add(_kernel.GetService <HelpCommand>());
                }
                else
                {
                    commandCollection.Add(_kernel.GetService <HelpCommand>());
                }
                return(commandCollection);
            }

            if (_instanceConfiguration.Install && _instanceConfiguration.Prep)
            {
                throw new ArgumentException("You can specify the install (-i) or prepare (-p) arguments, but not both");
            }

            if (_instanceConfiguration.Install || _instanceConfiguration.Prep)
            {
                if (string.IsNullOrEmpty(_instanceConfiguration.Environment))
                {
                    _output.WriteLine("Specify an environment");
                    commandCollection.Clear();
                    return(commandCollection);
                }

                commandCollection.Add(_kernel.GetService <AppLocatingCommand>());
                commandCollection.Add(_kernel.GetService <AppExtractionCommand>());

                if (_instanceConfiguration.Install)
                {
                    _output.WriteLine("Application will be installed");
                    commandCollection.Add(_kernel.GetService <SetEnvironmentCommand>());
                    commandCollection.Add(_kernel.GetService <AppInstallationCommand>());
                }
                else
                {
                    _output.WriteLine("Application will be prepared for installation only");
                }

                commandCollection.Add(_kernel.GetService <PurgeOldBackupsCommand>());
            }
            return(commandCollection);
        }