private IJSCSGlue InternalMap(object ifrom, object iadditional=null)
        {
            if (ifrom == null)
                return JSGenericObject.CreateNull(_IWebView);

            IJSCSGlue res = null;
            res = _Cacher.GetCached(ifrom);
            if (res != null)
            {
                return res;
            }

            if (ifrom is ICommand)
                return new JSCommand(_IWebView, _UIDispatcher, ifrom as ICommand);

            if (ifrom is ISimpleCommand)
                return new JSSimpleCommand(_IWebView, ifrom as ISimpleCommand);

            if (ifrom is IResultCommand)
                return new JSResultCommand(_IWebView, ifrom as IResultCommand);

            IJavascriptObject value;
            if (_IWebView.Factory.SolveBasic(ifrom, out value))
            {
                return new JSBasicObject(value, ifrom);
            }

            if (ifrom.GetType().IsEnum)
            {
                var trueres = new JSBasicObject(_IWebView.Factory.CreateEnum((Enum)ifrom), ifrom);
                _Cacher.CacheLocal(ifrom, trueres);
                return trueres;
            }

            IEnumerable ienfro = ifrom as IEnumerable;
            if ((ienfro!=null) && Convert(ienfro, out res))
            {
                return res;
            }

            IJavascriptObject resobject = _IWebView.Factory.CreateObject(true);

            JSGenericObject gres = new JSGenericObject(_IWebView,resobject, ifrom);
            _Cacher.Cache(ifrom, gres);

            MappNested(ifrom, resobject,gres);
            MappNested(iadditional, resobject, gres);

            return gres;
        }
        private IJSCSGlue InternalMap(object ifrom, object iadditional = null)
        {
            if (ifrom == null)
            {
                return(JSGenericObject.CreateNull(_IWebView));
            }

            IJSCSGlue res = null;

            res = _Cacher.GetCached(ifrom);
            if (res != null)
            {
                return(res);
            }

            if (ifrom is ICommand)
            {
                return(new JSCommand(_IWebView, _UIDispatcher, ifrom as ICommand));
            }

            if (ifrom is ISimpleCommand)
            {
                return(new JSSimpleCommand(_IWebView, ifrom as ISimpleCommand));
            }

            if (ifrom is IResultCommand)
            {
                return(new JSResultCommand(_IWebView, ifrom as IResultCommand));
            }

            IJavascriptObject value;

            if (_IWebView.Factory.SolveBasic(ifrom, out value))
            {
                return(new JSBasicObject(value, ifrom));
            }

            if (ifrom.GetType().IsEnum)
            {
                var trueres = new JSBasicObject(_IWebView.Factory.CreateEnum((Enum)ifrom), ifrom);
                _Cacher.CacheLocal(ifrom, trueres);
                return(trueres);
            }

            IEnumerable ienfro = ifrom as IEnumerable;

            if ((ienfro != null) && Convert(ienfro, out res))
            {
                return(res);
            }

            IJavascriptObject resobject = _IWebView.Factory.CreateObject(true);

            JSGenericObject gres = new JSGenericObject(_IWebView, resobject, ifrom);

            _Cacher.Cache(ifrom, gres);

            MappNested(ifrom, resobject, gres);
            MappNested(iadditional, resobject, gres);

            return(gres);
        }