public async Task <IActionResult> Edit(int Id, ShopCategory viewModel, IFormFile file)
        {
            if (Id == null)
            {
                return(NotFound());
            }

            if (User.IsInRole(Roles.Client) || !User.Identity.IsAuthenticated)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _shopCategoryService.AddFile(viewModel, file);

                    await _shopCategoryService.Update(viewModel);

                    if (!String.IsNullOrEmpty(Request.Form["continue"]))
                    {
                        return(RedirectToAction("Edit", new { Id = Id }));
                    }
                    if (!String.IsNullOrEmpty(Request.Form["new"]))
                    {
                        return(RedirectToAction(nameof(Create)));
                    }
                    return(RedirectToAction(nameof(Index)));
                }
                catch (DBConcurrencyException)
                {
                    var exists = await Exists(viewModel.Id);

                    if (!exists)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }

            var categories = await _shopCategoryService.GetAll();

            ViewBag.Categories = new SelectList(categories.ToList(), "Id", "Title", viewModel.ParentId);
            return(View(viewModel));
        }