public static T Value <T>(this CustomSetting setting)
 {
     if (!typeof(T).IsAssignableFrom(setting.GetValue().GetType()))
     {
         throw new InvalidCastException($"Cannot convert {setting.GetValue().GetType()} to type {typeof(T).ToString()}.");
     }
     return((T)setting.GetValue());
 }
 public static void AddOrUpdate(this Dictionary <string, CustomSetting> dict, CustomSetting setting)
 {
     if (dict.ContainsKey(setting.Name))
     {
         dict[setting.Name].SetValue(setting.GetValue());
     }
     else
     {
         dict.Add(setting.Name, setting);
     }
 }