private void UpdateProductCategories(C5Product c5Product, Product nopProduct)
        {
            var c5CategoryIds = GetC5ProductCategories(c5Product);
            var productCategoriesIds = nopProduct.ProductCategories.ToList();
            foreach (var productCategory in productCategoriesIds)
                _categoryService.DeleteProductCategory(productCategory);

            foreach (var c5Category in c5CategoryIds)
            {
                var productCategory = CreateProductCategory(nopProduct, c5Category);
                _categoryService.InsertProductCategory(productCategory);
            }
        }
 private ProductVariant CreateNopProductVariant(C5Product c5Product, Product nopProduct)
 {
     return new ProductVariant()
     {
         ProductId = nopProduct.Id,
         Published = true,
         DisplayOrder = 1,
         CreatedOnUtc = DateTime.UtcNow,
         UpdatedOnUtc = DateTime.UtcNow
     };
 }
 private ICollection<Category> GetC5ProductCategories(C5Product c5Product)
 {
     var categories = new List<Category>();
     foreach (var categoryName in c5Product.CategoryName.Split(','))
     {
         var existingCategories = _categoryService.GetAllCategories(categoryName, true);
         if (existingCategories.Count > 1)
         {
             foreach (var category in existingCategories)
             {
                 _categoryService.DeleteCategory(category);
             }
         }
         if (existingCategories.Count > 0)
         {
             categories.Add(existingCategories.First());
         }
         else {
             var category = new Category()
             {
                 CreatedOnUtc = DateTime.UtcNow,
                 UpdatedOnUtc = DateTime.UtcNow,
                 Name = c5Product.CategoryName,
                 Published = true
             };
             _categoryService.InsertCategory(category);
             categories.Add(category);
         }
     }
     return categories;
 }
 private Core.Domain.Catalog.Product CreateNopProduct(C5Product c5Product)
 {
     return new Product()
     {
         Name = c5Product.ProductName,
         CreatedOnUtc = DateTime.UtcNow,
         UpdatedOnUtc = DateTime.UtcNow
     };
 }