public static async Task UpdateZoneAsync(this SQLiteDatabase database, IZone zone) { using (SQLiteCommand cmd = new SQLiteCommand("UPDATE Zones SET name = $name, type = $type, type_id = $type_id, description = $description, parent_id = $parent_id, flags = $flags WHERE id = $id")) { cmd.Parameters.AddWithValue("$id", zone.Id); cmd.Parameters.AddWithValue("$parent_id", zone.ParentId); cmd.Parameters.AddWithValue("$name", zone.Name.ToLowerInvariant()); cmd.Parameters.AddWithValue("$type", zone.Type?.Name.ToLowerInvariant() ?? string.Empty); cmd.Parameters.AddWithValue("$type_id", zone.TypeId); cmd.Parameters.AddWithValue("$description", zone.Description); cmd.Parameters.AddWithValue("$flags", (long)zone.Flags); await database.ExecuteNonQueryAsync(cmd); } await database.RemoveZoneAliasesAsync(zone); await database.AddZoneAliasesAsync(zone); await database.RemoveZoneFieldsAsync(zone); await database.AddZoneFieldsAsync(zone); }