private void RegisterSubObject(string line, Dictionary <string, object> objectDictionary, Dictionary <object, List <ClassLoadInfo> > objectReferences, Stack <object> order, Metadata metadata,
                                       Dictionary <string, List <object> > placeholderLists, Dictionary <object, string> placeholderRealTypes, Dictionary <object, string> placeholderElementTypes)
        {
            object newObject = "BadValue";   //dummy value

            if (RH.ContainsCollection(line)) //is collection ?
            {
                newObject = new List <object>();
                placeholderLists.Add(metadata.Id, (List <object>)newObject); //register new placeholder
                placeholderRealTypes.Add(newObject, metadata.Type);
                string firstTypeName = RH.LookForListElementType(line);
                placeholderElementTypes.Add(newObject, firstTypeName);
            }
            else
            {
                newObject = GetInstance(metadata.Type);
            }

            objectDictionary.Add(metadata.Id, newObject);                //register object
            objectReferences.Add(newObject, new List <ClassLoadInfo>()); //register missing property

            //register in previous object properties
            var propertyForNewObjectInfo = new ClassLoadInfo()
            {
                Id   = metadata.Id,
                Name = metadata.Name,
            };

            objectReferences[order.Peek()].Add(propertyForNewObjectInfo);
            //
            order.Push(newObject);
        }
        private void RegisterRefIdObject(Stack <object> order, Dictionary <object, List <ClassLoadInfo> > objectReferences, Metadata metadata)
        {
            //register in previous object properties
            var propertyForNewObjectInfo = new ClassLoadInfo()
            {
                Id   = metadata.Id,
                Name = metadata.Name,
            };
            var topObject = order.Peek();

            if (topObject is IList)
            {
                var list = topObject as IList;
                list.Add(propertyForNewObjectInfo);
            }
            else
            {
                objectReferences[topObject].Add(propertyForNewObjectInfo);
            }
            order.Push(new object());
        }