public static void Main()
var template = new CustomPortletTemplate()
HtmlTemplate = "Test stuff"
var templateData = new CustomPortletTemplate()
CustomCardTemplateType = CustomCardTemplateType.CustomCardGlobal,
foreach (var prop in templateData.GetType().GetProperties())
var oldVal = prop.GetValue(template, null);
var newVal = prop.GetValue(templateData, null);
if (newVal != null && !object.Equals(oldVal, newVal))
prop.SetValue(template, newVal);
Console.WriteLine("Error updating property", Formatting.Indented);
Console.WriteLine(JsonConvert.SerializeObject(template));
public class CustomPortletTemplate
public int PortletTemplateId { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string Url { get; set; }
public string DefaultConfiguration { get; set; }
public string ServerTemplate { get; set; }
public string HtmlTemplate { get; set; }
public string ClientTemplate { get; set; }
public string StyleTemplate { get; set; }
public bool? IsCurrent { get; set; }
public bool? IsAdminOnly { get; set; }
public bool? CanOverrideConfig { get; set; }
public CustomCardTemplateType CustomCardTemplateType { get; set; }
public enum CustomCardTemplateType