public void SaveSettings <T>(string key, T setting) where T : ISettings { BEncodedValue val = setting.Encode(); storage.Store(key, val); //here flush but maybe have to done it in another function to save all setting before flush in file storage.Flush(); }