/// <summary>
        /// Configure the Application Blocks and <see cref="Container">composition root</see>
        /// and build the application's <see cref="ConsoleApplicationContext" />.
        /// </summary>
        /// <param name="dependencyContext">
        /// Optional: A <see cref="DependencyContext" /> to use for all registration
        /// discovery.
        /// </param>
        /// <returns>
        /// The <see cref="ConsoleApplicationContext" /> that will serve as the run context of
        /// your console application
        /// </returns>
        public ConsoleApplicationContext Build <TAppConfigInterface, TAppConfigImplementation>(
            DependencyContext dependencyContext = null
            )
            where TAppConfigInterface : class, IApplicationConfiguration
            where TAppConfigImplementation : class, TAppConfigInterface
        {
            var container = new Container();

            container.Options.DefaultLifestyle       = defaultLifestyle;
            container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle();

            var frameworkConfiguration = frameworkConfigurationBuilder.Build();

            container
            .AddApplicationConfiguration <TAppConfigInterface, TAppConfigImplementation>(frameworkConfiguration, hostingEnvironment)
            .AddEventLogging(defaultLifestyle)
            .AddCommands(defaultLifestyle, dependencyContext)
            .AddBootstrappers(dependencyContext);

            foreach (var module in modules)
            {
                module.RegisterServices(container);
            }

            container.Verify();

            if (container.GetRegistration(typeof(IEnumerable <IBootstrapper>)) != null)
            {
                using (AsyncScopedLifestyle.BeginScope(container))
                {
                    // Resolve and run IBootstrappers
                    foreach (var bootstrapper in container.GetAllInstances <IBootstrapper>())
                    {
                        bootstrapper.Bootstrap();
                    }
                }
            }

            return(new ConsoleApplicationContext(container));
        }