public ActionResult Edit(SalesModel model, int id)
        {
            if (ModelState.IsValid)
            {
                var category = _repository.First<Category>(x => x.Id == model.CategoryId);
                var sale = _mappingEngine.Map<SalesModel, Sale>(model);
                sale.Category = category;

                sale.CreateDateTime = System.DateTime.Now;
                _repository.Update(sale);
                return RedirectToAction("index");
            }
            return View("Create", model);
        }
        public ActionResult Create(SalesModel salesModel)
        {
            var category = _repository.First<Category>(x => x.Id == salesModel.CategoryId);

            var sale = _mappingEngine.Map<SalesModel, Sale>(salesModel);
            sale.Category = category;
            sale.CreateDateTime = System.DateTime.Now;
            _repository.Create<Sale>(sale);

            var account = _repository.First<Account>(x => x.Id == salesModel.AccountId);
            account.AddSale(sale);
            _repository.Update(account);

            return RedirectToAction("Index", "Sales");
        }