private void AddModelCollection <M>(ModelCollection <M> collection, String key) where M : Model { if (key == null) { key = GenerateDefaultKey <M>(); } modelLists.Add(key, collection); }
protected void AddModelCollection <M>(IJsonObject jsonNode, String key) where M : Model, new() { var collection = new ModelCollection <M>(); jsonNode.AsList.ForEach(jsonObject => { var model = new M(); model.LoadFromJson(jsonObject); collection.Add(model); }); AddModelCollection(collection, key); }