// TODO: Optimize connections
        private static void Save(Product product)
        {
            var server = new MongoClient("mongodb://localhost").GetServer();
            var db = server.GetDatabase("salesDB");
            var sales = db.GetCollection<Product>("productReports");

            sales.Insert(product);
        }
        public static void Generate()
        {
            using (var db = new SalesContext())
            {
                foreach (var product in db.Products)
                {
                    var path = DirectoryPath + product.Id + ".json";

                    Debug.WriteLine("Processing: " + path);
                    using (var output = new StreamWriter(path))
                    {
                        var records = db.Records.Where(x => x.Product.Id == product.Id);

                        if (!records.Any())
                        {
                            Debug.WriteLine("  Skipping...");
                            continue;
                        }

                        var quantity = records.Sum(x => x.Quantity);

                        var serializedProduct = new Product
                        {
                            ProductId = product.Id,
                            ProductName = product.Name,
                            VendorName = product.Vendor.Name,
                            TotalQuantitySold = quantity,
                            TotalIncomes = quantity * product.BasePrice
                        };

                        var result = JsonConvert.SerializeObject(serializedProduct, Formatting.Indented);

                        output.WriteLine(result);
                        Debug.WriteLine(result);

                        // TODO: Decouple
                        Save(serializedProduct);
                    }
                }
            }
        }