public NewsCategoryModel GetById(int id)
 {
     NewsCategoryModel categoryModel = null;
     using (var unitOfWork = _unitOfWorkFactory.Create())
     {
         try
         {
             var entity = unitOfWork.NewsCategoryRepository.GetByID(id);
             if (entity != null)
             {
                 categoryModel = new NewsCategoryModel(entity);
             }
             unitOfWork.Save();
         }
         catch (Exception e)
         {
             _logger.LogToFile(_logger.CreateErrorMessage(e));
         }
         return categoryModel;
     }
 }
 public ResponseBase Update(NewsCategoryModel newsCategory)
 {
     ResponseBase response;
     using (var unitOfWork = _unitOfWorkFactory.Create())
     {
         try
         {
             if (newsCategory != null)
             {
                 unitOfWork.NewsCategoryRepository.Update(newsCategory.ToEntity());
             }
             unitOfWork.Save();
             response = new ResponseBase(){IsSucceed = true, Message = Modules.Resources.Logic.NewsCategoryUpdateSuccess };
         }
         catch (Exception e)
         {
             _logger.LogToFile(_logger.CreateErrorMessage(e));
             response = new ResponseBase() { IsSucceed = false, Message = Modules.Resources.Logic.NewsCategoryUpdateFailed };
         }
         return response;
     }
 }