public object Load(Type type, QSharp.QNode q, Dictionary <string, Dictionary <object, object> > data)
 {
     if (q == null)
     {
         return(null);
     }
     return(GetLoader(type)(type, q, data));
 }
        public object LoadStructure(Type type, QSharp.QNode q, Dictionary <string, Dictionary <object, object> > data)
        {
            var typeInfo = SerializeInfoByType(type);

            if (typeInfo == null || typeInfo.Constructor == null)
            {
                return(null);
            }

            var sourceValues = new QNode[typeInfo.Parameters.Length][];

            if (q.Nodes != null)
            {
                var i = -1;
                foreach (var node in q.Nodes)
                {
                    var name = node.Value?.ToString();
                    i++;
                    if (i >= typeInfo.Parameters.Length || typeInfo.Parameters[i].Name != name)
                    {
                        var _i = typeInfo.ParameterIndexByName.FindValue(name);
                        if (_i == null)
                        {
                            continue;
                        }
                        i = _i.Value;
                    }
                    sourceValues[i] = ArrayConcat(sourceValues[i], node.Nodes.ToArray());
                }
            }


            var values = new object[typeInfo.Parameters.Length];

            for (var i = 0; i < typeInfo.Parameters.Length; ++i)
            {
                var p = typeInfo.Parameters[i];

                var qs    = p.IsId ? new[] { new QSharp.QNode(q.Value) } : sourceValues[i];
                var value = p.RefProperty != null
                    ? Load_Ref(p.RefProperty, p.ParameterType, qs, data)
                    : Load_s(p.ParameterType, qs, data);

                if (value == null && p.ParameterType == typeof(bool))
                {
                    value = false;
                }


                values[i] = value;

                var prop_pushes = typeInfo.Pushes.Find(p.Name);
                if (prop_pushes == null)
                {
                    continue;
                }

                foreach (var push in prop_pushes)
                {
                    data = new Dictionary <string, Dictionary <object, object> >(data);
                    var elementType     = push.ElementType ?? Collection_ElementType(p.ParameterType);
                    var elementTypeInfo = SerializeInfoByType(elementType);

                    //var elementIdType = IdPropertyByType.Find(elementType);
                    //var elementIdProperty = Properties(elementType).FirstOrDefault(child => child.Name == elementIdType);
                    var val = push.Converter != null?push.Converter(value) : value;

                    data[push.Name] =
                        Else_Empty(val.As <System.Collections.IEnumerable>())
                        .OfType <object>()
                        .ToDictionary(obj => GetId(obj, elementTypeInfo.IdProperty));
                }
            }

            return(typeInfo.Construct != null?typeInfo.Construct(values) : typeInfo.Constructor.Invoke(values));
        }