public void SaveSettings <T>(T settingsobject)
        {
            SettingsObjectInfo            info     = GetObjectInfo <T>();
            IDictionary <string, Setting> settings = GetSettings(info.Keys);
            IList <Setting> addingSettings         = new List <Setting>();
            IList <Setting> updatingSettings       = new List <Setting>();

            foreach (var property in info.Properties)
            {
                string value = property.Property.GetValue(settingsobject)?.ToString();

                if (settings.ContainsKey(property.Key))
                {
                    Setting setting = settings[property.Key];
                    setting.Value = value;
                    updatingSettings.Add(setting);
                }
                else
                {
                    addingSettings.Add(new Setting
                    {
                        Key   = property.Key,
                        Value = value
                    });
                }
            }

            AddRange(addingSettings);
            UpdateRange(updatingSettings);
        }
        private SettingsObjectInfo CreateObjectInfo(Type type)
        {
            SettingsObjectInfo info = new SettingsObjectInfo
            {
                Properties = GetProperties(type)
            };

            info.Keys = GetKeys(info.Properties);

            return(info);
        }
        public T GetSettings <T>() where T : new()
        {
            T obj = new T();
            SettingsObjectInfo            info     = GetObjectInfo <T>();
            IDictionary <string, Setting> settings = GetSettings(info.Keys);

            foreach (var property in info.Properties)
            {
                if (settings.ContainsKey(property.Key))
                {
                    property.Property.SetValue(obj, settings[property.Key].Value);
                }
            }

            return(obj);
        }