public virtual ActionResult EditCategory(int categoryId)
        {
            AddEditCategoryViewModel vm = TempData["AddEditCategoryViewModel"] as AddEditCategoryViewModel;
            if (vm == null)
            {
                var category = _accountService.GetCategory(categoryId).Result;
                vm = new AddEditCategoryViewModel()
                {
                    CategoryId = category.Id,
                    CategoryGroup = category.CategoryGroupId,
                    Name = category.Name
                };
            }
            vm.IsEditMode = true;

            // available category groups
            var categoryGroups = _accountService.GetAllCategoryGroups().Result;
            vm.AvailableCategoryGroups = categoryGroups.OrderBy(x => x.Name).Select(x => new CategoryGroupDto() { Id = x.Id, Name = x.Name }).ToList();

            return PartialView("AddEditCategory", vm);
        }
        public virtual ActionResult EditCategoryPost(AddEditCategoryViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                TempData["AddEditCategoryViewModel"] = viewModel;
                viewModel.IsError = true;
                return RedirectToAction(MVC.Account.Category(viewModel.CategoryId));
            }

            _accountService.UpdateCategory(viewModel.CategoryId, viewModel.Name);

            return RedirectToAction(MVC.Account.Category(viewModel.CategoryId));
        }
        public virtual ActionResult AddCategoryPost(AddEditCategoryViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                TempData["AddEditCategoryViewModel"] = viewModel;
                viewModel.IsError = true;
                return RedirectToAction(MVC.Account.Categories());
            }

            var result = _accountService.AddCategory(viewModel.Name, viewModel.CategoryGroup);

            return RedirectToAction(MVC.Account.Categories());
        }