private static void Timer_Elapsed(object sender, ElapsedEventArgs e) { if (client == null || client.Connection == null) { throw new TraceStateException("No connection to local db."); } lock (critSec) { List <Log> b = new List <Log>(); foreach (LogBuffer logBuff in Arbiter.ToList()) { b.AddRange(logBuff.Logs); } if (b.Count == 0) { return; } Collection.InsertMultiple(b); Arbiter.Clear(); } }