private Cathegory getCathegoryByName(Long catId) throws PresentationException {
   Cathegory cathegory = baseDao.getEntity(catId, Cathegory.class);
   if (cathegory == null) {
     throw new PresentationException();
   }
   return cathegory;
 }
 @RolesAllowed(value = {"ROLE_USER"})
 @RequestMapping(value = "/uploadFile", method = RequestMethod.POST, produces = "application/json")
 @ResponseBody
 public Map<String, Object> uploadFile(
     HttpServletRequest req, @RequestParam("fileData") CommonsMultipartFile uploadedFile) {
   Map<String, Object> result = null;
   if (uploadedFile == null) {
     result = JsonUtils.failureJson();
   } else {
     try {
       if (uploadedFile.isEmpty()) {
         String errorMessage = messages.getMessage("validation.upload.file.is.empty", null, null);
         result = JsonUtils.failureJson(errorMessage);
       } else {
         HttpSession session = req.getSession();
         Presentation data = uploadFileToRepo(uploadedFile, session);
         if (data != null) {
           Long id = baseDao.save(data);
           Job job = new Job(id);
           queue.send(job, UPLOAD_QUEUE);
           result =
               JsonUtils.successWithParameter(
                   JsonUtils.PARAM_MESSAGE, messages.getMessage("upload.success", null, null));
         } else {
           String errorMessage =
               messages.getMessage("validation.upload.first.set.metadata", null, null);
           result = JsonUtils.failureJson(errorMessage);
         }
         session.removeAttribute(UPLOAD_METADATA);
       }
     } catch (UploadedDataNotFoundException e) {
       String errorMessage =
           messages.getMessage("validation.upload.first.set.metadata", null, null);
       result = JsonUtils.failureJson(errorMessage);
     } catch (IllegalStateException | IOException e) {
       String errorMessage = messages.getMessage("validation.upload.failed", null, null);
       result = JsonUtils.failureJson(errorMessage);
     } catch (IncorectFileException e) {
       String errorMessage =
           messages.getMessage("validation.upload.incorect.file.extension", null, null);
       String acceptedEx = getExtensions(acceptedExtensions);
       result = JsonUtils.failureJson(errorMessage + acceptedEx);
     }
   }
   return result;
 }