public TemplateBase FindTemplate <T>(T instance)
        {
            Type targetType = instance.GetType();

            while (true)
            {
                TemplateBase template = Templates.FirstOrDefault(x => x.TargetType == targetType);
                if (template != null)
                {
                    return(template);
                }
                targetType = targetType?.BaseType;
            }
        }
 public void Add(TemplateBase template)
 {
     Templates.Add(template);
 }