/// <summary>
        /// Registers modules found in an assembly.
        /// </summary>
        /// <param name="builder">The builder to register the modules with.</param>
        /// <param name="assemblies">The assemblies from which to register modules.</param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if <paramref name="builder"/> is <see langword="null"/>.
        /// </exception>
        /// <returns>
        /// The <see cref="IModuleRegistrar"/> to allow
        /// additional chained module registrations.
        /// </returns>
        public static IModuleRegistrar RegisterAssemblyModules(this ContainerBuilder builder, params Assembly[] assemblies)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            var registrar = new ModuleRegistrar(builder);

            return(registrar.RegisterAssemblyModules <IModule>(assemblies));
        }
        /// <summary>
        /// Registers modules found in an assembly.
        /// </summary>
        /// <param name="builder">The builder to register the modules with.</param>
        /// <param name="assemblies">The assemblies from which to register modules.</param>
        /// <typeparam name="TModule">The type of the module to add.</typeparam>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown if <paramref name="builder"/> is <see langword="null"/>.
        /// </exception>
        /// <returns>
        /// The <see cref="Autofac.Core.Registration.IModuleRegistrar"/> to allow
        /// additional chained module registrations.
        /// </returns>
        public static IModuleRegistrar RegisterAssemblyModules <TModule>(this ContainerBuilder builder, params Assembly[] assemblies)
            where TModule : IModule
        {
            if (builder == null)
            {
                throw new ArgumentNullException("builder");
            }

            var registrar = new ModuleRegistrar(builder);

            return(registrar.RegisterAssemblyModules(typeof(TModule), assemblies));
        }
        /// <summary>
        /// Registers modules found in an assembly.
        /// </summary>
        /// <param name="builder">The builder to register the modules with.</param>
        /// <param name="moduleType">The <see cref="Type"/> of the module to add.</param>
        /// <param name="assemblies">The assemblies from which to register modules.</param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown if <paramref name="builder"/> or <paramref name="moduleType"/> is <see langword="null"/>.
        /// </exception>
        /// <returns>
        /// The <see cref="Autofac.Core.Registration.IModuleRegistrar"/> to allow
        /// additional chained module registrations.
        /// </returns>
        public static IModuleRegistrar RegisterAssemblyModules(this ContainerBuilder builder, Type moduleType, params Assembly[] assemblies)
        {
            if (builder == null)
            {
                throw new ArgumentNullException("builder");
            }

            if (moduleType == null)
            {
                throw new ArgumentNullException("moduleType");
            }

            var registrar = new ModuleRegistrar(builder);

            return(registrar.RegisterAssemblyModules(moduleType, assemblies));
        }