/// <inheritdoc />
        public IModuleBuilder BuildModule(IModuleBuilder parent, Type type)
        {
            type.NotNull(nameof(type));

            if (parent.HasNoContent() && !IsModule(type))
            {
                throw new ArgumentException(nameof(type), $"{type.FullName} is not a valid module.");
            }

            if (parent.HasContent() && !IsSubModule(type))
            {
                throw new ArgumentException(nameof(type), $"{type.FullName} is not a valid submodule.");
            }

            var name               = GetName(type);
            var description        = GetDescription(type);
            var remarks            = GetRemarks(type);
            var runMode            = GetRunMode(type);
            var ignoreExtraArgs    = GetIgnoreExtraArgs(type);
            var argumentParserType = GetArgumentParserType(type);
            var multiMatchHandling = GetMultiMatch(type);
            var alias              = GetAlias(type);
            var enabled            = GetEnabled(type);
            var attributes         = GetAttributes(type);
            var preconditions      = GetPreconditions(attributes);
            var invoker            = GetInvoker(type);

            var builder = new ModuleBuilder()
                          .WithType(type)
                          .WithName(name)
                          .WithDescription(description)
                          .WithRemarks(remarks)
                          .WithRunMode(runMode)
                          .WithIgnoreExtraArgs(ignoreExtraArgs)
                          .WithArgumentParserType(argumentParserType)
                          .WithMultiMatch(multiMatchHandling)
                          .WithAlias(alias)
                          .WithEnabled(enabled)
                          .WithAttributes(attributes)
                          .WithPreconditions(preconditions)
                          .WithParent(parent)
                          .WithInvoker(invoker);

            var subModules = GetSubModules(builder, type);
            var commands   = GetCommands(builder);

            builder.WithSubmodules(subModules);
            builder.WithCommands(commands);

            return(builder);
        }