public async Task <IActionResult> Insert(ProductFormViewModel viewModel)
        {
            if (viewModel.categoryList.Count == 0)
            {
                TempData["MSG_E"] = Message.MSG_E_005;
                ICollection <Category> list = await _categoryRepository.FindAllsAsync(_employeeLogin.GetEmployee().BusinessId);

                ViewBag.Category = list.Select(x => new SelectListItem(x.Name, x.Id.ToString()));
                return(View(nameof(Insert), viewModel));
            }
            if (ModelState.IsValid)
            {
                viewModel.Product.InsertDate         = DateTime.Now;
                viewModel.Product.RegisterEmployeeId = _employeeLogin.GetEmployee().BusinessId;
                _productRepository.Insert(viewModel.Product);

                foreach (var item in viewModel.categoryList)
                {
                    _categoryProductRepository.Insert(new List <CategoryProduct> {
                        new CategoryProduct {
                            ProductId = viewModel.Product.Id, CategoryId = item
                        }
                    });
                }

                TempData["MSG_S"] = Message.MSG_S_002;
                return(RedirectToAction(nameof(Index)));
            }
            ICollection <Category> listCat = await _categoryRepository.FindAllsAsync(_employeeLogin.GetEmployee().BusinessId);

            ViewBag.Category = listCat.Select(x => new SelectListItem(x.Name, x.Id.ToString()));
            return(View(viewModel));
        }