private static async Task InseriDocumentoNoMongo(NFE_MONGO documento)
        {
            string connectionString = "mongodb://localhost:27017";
            var    url = MongoUrl.Create(connectionString);

            MongoClient client = new MongoClient(new MongoClientSettings
            {
                MaxConnectionPoolSize = 6000,
                WaitQueueSize         = 6000,
                Server = url.Server
            });

            IMongoDatabase db = client.GetDatabase("fiscal");

            var _NFE_ITENS_MONGO = db.GetCollection <NFE_MONGO>("NFE_ITENS_MONGO");

            await _NFE_ITENS_MONGO.InsertOneAsync(documento);

            Console.WriteLine("Arquivo inserido: " + documento._chave);
        }
        private static async Task ProcessaArquivos(ConcurrentBag <nfeProc> documentos)
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            var listaDeDocumentos = new ConcurrentBag <NFE_MONGO>();

            Parallel.ForEach(documentos, new ParallelOptions {
                MaxDegreeOfParallelism = Environment.ProcessorCount * 2
            }, file =>
            {
                var novoDocumento = new NFE_MONGO
                {
                    _chave     = file.protNFe.infProt.chNFe,
                    _cnpjDest  = file.NFe.infNFe.dest.CNPJ,
                    _cnpjEmit  = file.NFe.infNFe.emit.CNPJ,
                    _emissao   = file.NFe.infNFe.ide.dEmi,
                    _ieDest    = file.NFe.infNFe.dest.IE,
                    _ieEmit    = file.NFe.infNFe.emit.IE,
                    _imEmit    = file.NFe.infNFe.emit.IM,
                    _razaoDest = file.NFe.infNFe.dest.xNome,
                    _razaoEmit = file.NFe.infNFe.emit.xNome,
                    _NumeroNF  = file.NFe.infNFe.ide.nNF.ToString()
                };

                listaDeDocumentos.Add(novoDocumento);
            });

            await InseriDocumentoNoMongo(listaDeDocumentos);

            TimeSpan ts = stopWatch.Elapsed;

            string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);

            Console.WriteLine("Parallel Foreach(Convertendo Doc) " + elapsedTime);
            Console.WriteLine("Terminou");
        }