public ActionResult CreateCategory(CategoryCreateViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         var bllCategory = new CategoryEntity()
         {
             CategoryName = viewModel.CategoryName,
             CreationDate = DateTime.Now,
             IsBlocked = false,
             IsConfirmed = false,
             SectionRefId = viewModel.SectionRefId
         };
         if (User.IsInRole("Administrator"))
         {
             bllCategory.IsConfirmed = true;
         }
         _categoryService.CreateCategory(bllCategory);
         if (!User.IsInRole("Administrator"))
         {
             var request = new RequestEntity()
             {
                 ToConfirm = true,
                 SectionRefId = bllCategory.SectionRefId
             };
             var entity = _categoryService.GetAllCategoryEntities()
                 .FirstOrDefault(c => c.CategoryName == bllCategory.CategoryName);
             if (entity != null)
                 request.CategoryRefId =entity.Id;
             _requestService.CreateRequest(request);
         }
         return RedirectToAction("Categories", "Moderator", new {id = viewModel.SectionRefId});
     }
     return View(viewModel);
 }
 public void UpdateCategory(CategoryEntity entity)
 {
     try
     {
         _categoryRepository.Update(entity.ToDalCategory());
         _unitOfWork.Commit();
     }
     catch (Exception exception)
     {
         Log.LogError(exception);
     }
 }