protected ActionBlock <T> CreateStoreActionBlock <T>(out Task dbxStore) where T : class
        {
            var buffer = new SynchronizedBlockingCollection <T>();
            var store  = new ActionBlock <T>(item => { buffer.Add(item); });

            store.Completion.ContinueWith(_ => buffer.CompleteAdding());
            dbxStore = this.CreateDbxStore(buffer);
            return(store);
        }
 private Task CreateDbxStore <T>(SynchronizedBlockingCollection <T> buffer) where T : class
 {
     return(Task.Run(async() =>
     {
         using (var dbx = this.NetfoxDBContextFactory.Create())
         {
             await dbx.BulkInsertBuffered(buffer.GetConsumingEnumerable(), this.GetBulkInsertOptions());
             await dbx.SaveChangesAsync();
         }
     }));
 }