public TestCatalogRepository() {
            
            //load up the repo list
            productList = new List<Product>();
            categoryList = new List<Category>();

            for (int i = 1; i <= 5; i++) {
                Product p = new Product();
                p.Name = "Product" + i.ToString();
                p.ID = i;
                p.Price = 10M;
                p.Description = "Test Description";
                p.ProductCode = "SKU" + i.ToString();
                p.WeightInPounds = 5;


                //set first three products to shipped
                p.Delivery = i <= 3 ? DeliveryMethod.Shipped : DeliveryMethod.Download;


                //set first three products to Back-orderable
                p.AllowBackOrder = i <= 3;

                //set the 2nd product to BackOrder
                p.Inventory = i == 2 ? InventoryStatus.BackOrder : InventoryStatus.InStock;

                //set all products to taxable, except the 5th
                p.IsTaxable = i != 5;


                //add three images
                p.Images = new LazyList<ProductImage>(GetProductImages().Take(3));
                //reviews
                p.Reviews = new LazyList<ProductReview>(GetReviews().Take(5));
                p.Descriptors = new LazyList<ProductDescriptor>();

                //descriptors
                p.Descriptors.Add(new ProductDescriptor(p.ID, "Test", "Body"));
                p.Recommended = new LazyList<Product>();

                //have it recommend itself, for now
                p.Recommended.Add(p);

                //related
                p.RelatedProducts = new LazyList<Product>();
                p.RelatedProducts.Add(new Product("rel1", "test", 1, 0, 5));
                p.RelatedProducts.Add(new Product("rel1", "test", 1, 0, 5));
                p.RelatedProducts.Add(new Product("rel1", "test", 1, 0, 5));
                p.RelatedProducts.Add(new Product("rel1", "test", 1, 0, 5));

                //add some Crosses
                p.CrossSells = new LazyList<Product>();
                p.CrossSells.Add(new Product("cross1", "test", 1, 0, 5));
                p.CrossSells.Add(new Product("cross2", "test", 1, 0, 5));
                p.CrossSells.Add(new Product("cross3", "test", 1, 0, 5));
                productList.Add(p);
            }

            //categories
            for (int i = 1; i <= 10; i++)
            {

                Category c = new Category();
                c.ID = i;
                c.IsDefault = i == 1;
                c.Name = "Parent" + i.ToString();
                c.ParentID = 0;
                c.Image = new CategoryImage("thumb", "full");

                int subCategoryID = 10 * i;
                for (int x = 10; x <= 20; x++)
                {
                    Category sub = new Category();
                    sub.ID = subCategoryID;
                    sub.Name = "Sub" + x.ToString();
                    sub.ParentID = i;
                    sub.Image = new CategoryImage("thumb", "full");

                    //add some products
                    sub.Products = new LazyList<Product>();
                    for (int p = 1; p <= 5; p++)
                    {
                        sub.Products.Add(productList[p-1]);
                    }


                    categoryList.Add(sub);
                    subCategoryID++;
                }
                categoryList.Add(c);
            }


        }
        private static void PopulateSqlDatabase(List<MongoProduct> list)
        {
            using (var uow = CommerceModelUnitOfWork.UnitOfWork()) {
                var categories = uow.Categories.ToDictionary(item => item.CategoryName, StringComparer.OrdinalIgnoreCase);
                var publishers = uow.Publishers.ToDictionary(item => item.PublisherName, StringComparer.OrdinalIgnoreCase);

                foreach (var categoryName in list.Where(item => !string.IsNullOrWhiteSpace(item.Binding)).Select(item => item.Binding).ToList().Distinct()) {
                    Category category = null;
                    if (!categories.TryGetValue(categoryName, out category)) {
                        category = new Category() {
                            CategoryName = categoryName
                        };
                        categories.Add(categoryName, category);
                        uow.Add(category);
                    }
                }

                foreach (var publisherName in list.Where(item => !string.IsNullOrWhiteSpace(item.Publisher)).Select(item => item.Publisher).ToList().Distinct()) {
                    Publisher publisher = null;
                    if (!publishers.TryGetValue(publisherName, out publisher)) {
                        publisher = new Publisher() {
                            PublisherName = publisherName
                        };
                        publishers.Add(publisherName, publisher);
                        uow.Add(publisher);
                    }
                }

                foreach (var sourceProduct in list) {
                    Category category = null;
                    Publisher publisher = null;
                    if (!string.IsNullOrWhiteSpace(sourceProduct.Binding)) {
                        category = categories[sourceProduct.Binding];
                    }
                    if (!string.IsNullOrWhiteSpace(sourceProduct.Publisher)) {
                        publisher = publishers[sourceProduct.Publisher];
                    }
                    if (sourceProduct.PackageDimensions == null) {
                        sourceProduct.PackageDimensions = new Dimension();
                    }
                    var product = new Product() {
                        Asin = sourceProduct.ASIN,
                        BuyItNowPrice = sourceProduct.BuyItNowPrice,
                        Category = category,
                        EsrbAgeRating = sourceProduct.ESRBAgeRating,
                        Feature = string.Join(Environment.NewLine, sourceProduct.Feature),
                        Format = sourceProduct.Format,
                        Genre = sourceProduct.Genre.MaxLength(75),
                        HardwarePlatform = sourceProduct.HardwarePlatform.MaxLength(75),
                        Height = sourceProduct.PackageDimensions.Height,
                        LargeImage = sourceProduct.LargeImage,
                        Length = sourceProduct.PackageDimensions.Length,
                        ListPrice = sourceProduct.ListPrice,
                        Manufacturer = sourceProduct.Manufacturer,
                        Model = sourceProduct.Model,
                        PartNumber = sourceProduct.PartNumber,
                        ProductGroup = sourceProduct.ProductGroup,
                        Publisher = publisher,
                        Title = sourceProduct.Title.MaxLength(250),
                        Weight = sourceProduct.PackageDimensions.Weight,
                        Width = sourceProduct.PackageDimensions.Width
                    };
                    uow.Add(product);
                }

                var sw = new Stopwatch();
                sw.Start();

                uow.SaveChanges();

                sw.Stop();

                Console.WriteLine(sw.ElapsedMilliseconds);
                Console.ReadLine();
            }
        }
        public void SaveCategoryView(string userName, string IP, Category category)
        {
            //track this request
            UserEvent ue = new UserEvent(userName, IP,
                category.ID, null, System.Guid.Empty, UserBehavior.ViewCategory);
            _pRepo.Save(ue);

        }