private static T Update <T>(TomlTable table, string key, T obj) where T : TomlObject { if (table.TryGetValue(key, out var _)) { table.SetRow(new TomlKey(key), obj); return(obj); } else { throw new InvalidOperationException($"Cannot update because row with key '{key}' does not exist."); } }