void Write(DatabaseCompat db, ref ProtoWriter.State state) { try { var watch = Stopwatch.StartNew(); state.SerializeRoot(db); state.Close(); watch.Stop(); Log?.WriteLine($"Serialized: {watch.ElapsedMilliseconds}ms"); } catch { state.Abandon(); throw; } }