/// <summary> /// Remove the model association from the the ElementModel /// </summary> /// <param name="id"></param> /// <param name="model"></param> public void RemoveModel(Guid id, ElementModelViewModel model) { var models = GetModels(id); if (models != null) { models.Remove(model); if (!models.Any()) { _instances.Remove(id); } } }
/// <summary> /// Create an association between the ElementModel and the View Model /// </summary> /// <param name="id"></param> /// <param name="model"></param> public void AddModel(Guid id, ElementModelViewModel model) { var models = GetModels(id); if (models != null) { models.Add(model); } else { _instances.Add(id, new List <ElementModelViewModel>(new [] { model })); } }