private Func <IGlueFactory, object, IJsCsGlue> GetConverter(Type type, object @object)
        {
            if (type.IsEnum)
            {
                return(BuildEnum);
            }

            if (@object is ICommand)
            {
                return(BuildCommand);
            }

            if (@object is ISimpleCommand)
            {
                return(BuildSimpleCommand);
            }

            if (@object is IResultCommand)
            {
                return(BuildResultCommand);
            }

            var stringDictioanryValueType = type.GetDictionaryStringValueType();

            if (stringDictioanryValueType != null)
            {
                var objectDictionaryBuilder = new GlueObjectDictionaryBuilder(this, stringDictioanryValueType);
                return(objectDictionaryBuilder.Convert);
            }

            var dynamicObject = @object as DynamicObject;

            if (dynamicObject != null)
            {
                return(GlueObjectDynamicBuilder.Convert);
            }

            if (@object is IList)
            {
                return(new GlueCollectionsBuilder(this, type).ConvertList);
            }

            if (@object is ICollection)
            {
                return(new GlueCollectionsBuilder(this, type).ConvertCollection);
            }

            if (@object is IEnumerable)
            {
                return(new GlueCollectionsBuilder(this, type).ConvertEnumerable);
            }

            var objectBuilder = new GlueObjectBuilder(this, _Logger, type);

            return(objectBuilder.Convert);
        }
        private Func <IGlueFactory, object, IJsCsGlue> GetConverter(Type type, object @object)
        {
            if (type.IsEnum)
            {
                return(BuildEnum);
            }

            var simpleType = type.GetInterfaceGenericType(Types.SimpleCommand);

            if (simpleType != null)
            {
                var builder = _SimpleFactory.Build <IJsCsGlue>(simpleType);
                return((fact, obj) => builder.Invoke(fact, obj));
            }

            if (@object is ISimpleCommand)
            {
                return(BuildSimpleCommand);
            }

            simpleType = type.GetInterfaceGenericType(Types.GenericCommand);
            if (simpleType != null)
            {
                var builder = _CommandFactory.Build <IJsCsGlue>(simpleType);
                return((fact, obj) => builder.Invoke(fact, obj));
            }

            switch (@object)
            {
            case ICommandWithoutParameter _:
                return(BuildCommandWithoutParameter);

            case ICommand _:
                return(BuildCommand);
            }

            simpleType = type.GetInterfaceGenericType(Types.ResultCommand);
            if (simpleType != null)
            {
                var builder = _ResultCommandFactory.Build <IJsCsGlue>(simpleType);
                return((fact, obj) => builder.Invoke(fact, obj));
            }

            var types = type.GetInterfaceGenericTypes(Types.ResultCommandWithTArg);

            if (types != null)
            {
                var builder = _ResultCommandWithTArgFactory.Build <IJsCsGlue>(types.Item1, types.Item2);
                return((fact, obj) => builder.Invoke(fact, obj));
            }

            var stringDictionaryValueType = type.GetDictionaryStringValueType();

            if (stringDictionaryValueType != null)
            {
                var objectDictionaryBuilder = new GlueObjectDictionaryBuilder(this, stringDictionaryValueType);
                return(objectDictionaryBuilder.Convert);
            }

            switch (@object)
            {
            case DynamicObject _:
                return(GlueObjectDynamicBuilder.Convert);

            case IList _:
                return(new GlueCollectionsBuilder(this, type).ConvertList);

            case ICollection _:
                return(new GlueCollectionsBuilder(this, type).ConvertCollection);

            case IEnumerable _:
                return(new GlueCollectionsBuilder(this, type).ConvertEnumerable);
            }

            var objectBuilder = new GlueObjectBuilder(this, _Logger, type);

            return(objectBuilder.Convert);
        }