/**
  * Assign or remove role for a user
  *
  * @param createRoleParameter - an object that contains all the parameter that can or have to be
  *     used for such a request
  * @param blogId identifier of the blog
  * @param role role of the blog
  * @throws NoBlogManagerLeftException no active user with managment rights
  * @throws BlogNotFoundException blog not found
  * @throws BlogAccessException can not access blog
  * @throws CommunoteEntityNotFoundException can not found entity (user/group)
  */
 private void assignOrRemoveRoleForUser(
     CreateRoleParameter createRoleParameter, Long blogId, BlogRole role)
     throws NoBlogManagerLeftException, BlogNotFoundException, BlogAccessException,
         CommunoteEntityNotFoundException {
   User user = getUserManagement().findUserByAlias(createRoleParameter.getUserAlias());
   if (user != null) {
     assignOrRemoveRoleForEntity(blogId, role, user.getId());
   } else {
     throw new CommunoteEntityNotFoundException();
   }
 }
 /** {@inheritDoc} */
 @Override
 public void processAsynchronously(Long noteId, NoteStoringPostProcessorContext context) {
   Note note = getNoteDao().load(noteId);
   if (note == null) {
     return;
   }
   Set<Long> userIdsToSkip = context.getUserIdsToSkip();
   Collection<User> usersToNotify = getUsersToNotify(note, context);
   Collection<User> usersToSendMessage = new HashSet<User>();
   if (usersToNotify != null) {
     for (User user : usersToNotify) {
       if (!userIdsToSkip.contains(user.getId())
           && (user.hasStatus(UserStatus.ACTIVE))
           && getNotificationService()
               .userHasSchedule(
                   user.getId(), getNotificationDefinition(), NotificationScheduleTypes.IMMEDIATE)
           && (!note.getUser().getId().equals(user.getId()) || notifyAuthor())) {
         usersToSendMessage.add(user);
         userIdsToSkip.add(user.getId());
       }
     }
     if (usersToSendMessage.size() > 0) {
       getNotificationService().sendMessage(note, usersToSendMessage, getNotificationDefinition());
     }
   }
 }