private async Task PersistPositions() { if (_positions.Count() < 1) { return; } using (var scope = _scopeFactory.CreateScope()) { var db = GetContext(scope); await db.Positions.AddRangeAsync(_positions.Flattened()); await db.SaveChangesAsync(); } _positions.Clear(); }