private void ParseItemToListViewmodels(Goetia item) { // update the list viewmodel Type type = item.GetType(); BindingFlags flags = BindingFlags.Public | BindingFlags.Instance; PropertyInfo[] properties = type.GetProperties(flags); foreach (PropertyInfo property in properties) { // excluding Keywords, Direction, ImageURL, BaseModel, ID, Name, Description if (property.Name != nameof(Goetia.Keywords) && property.Name != nameof(Goetia.Direction) && property.Name != nameof(Goetia.ImageURL) && property.Name != nameof(Goetia.Success) && property.Name != nameof(Goetia.Message) && property.Name != nameof(Goetia.ID) && property.Name != nameof(Goetia.Name) && property.Name != nameof(Goetia.Description)) { string name = property.Name; object propertyValue = property.GetValue(GoetiaItem, null); if (propertyValue != null) { string info = ""; // we're expecting string or list of string if (propertyValue is string) { info = propertyValue as string; ListViewModels.Add(new GoetiaDetailInformationViewModel($"{name} : ", info)); } else if (propertyValue is List <string> ) { List <string> list = propertyValue as List <string>; if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { info += list[i]; if (i + 1 < list.Count) { info += ", "; } } ListViewModels.Add(new GoetiaDetailInformationViewModel($"{name} : ", info)); } } } } } }