@RequestMapping(value = "addTask", method = RequestMethod.POST)
    public @ResponseBody
    TodoTask addTask(@RequestParam String title, @RequestParam String content,
                     @RequestParam String targetTime, @RequestParam Integer priority,
                     @RequestParam Integer list, WebRequest webRequest) {
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        if (authentication.isAuthenticated() && (authentication.getPrincipal() instanceof User)) {
            TodoTask task = new TodoTask();
            TodoList todoList = todoListsDAO.findListById(list);
            if (todoList == null)
                return null;
            TodoUser todoUser = (TodoUser) webRequest.getAttribute("user", WebRequest.SCOPE_SESSION);
            task.setAuthor(todoUser);
            task.setList(todoList);
            if (todoList.getAuthor().getId().intValue() != todoUser.getId().intValue()
                && !"ROLE_ADMIN".equals(todoUser.getRole())
                && todoList.getPubStatus() != TodoList.STATUS_PUBLIC_EDIT)
                return null;
            try {
                Date target = TodoController.DATE_FORMAT.parse(targetTime);
                task.setTargetTime(target);
            } catch (ParseException ex) {
                return null;
            }
            task.setTitle(title);
            task.setContent(content);
            task.setPriority(priority);
            todoTasksDAO.addTask(task);
            return task;
        }
        return null;
    }