private User getUser(UserId userId) throws UserNotFoundException {
    User user = userRepository.findOne(userId.id);

    if (user == null) {
      throw new UserNotFoundException(format("User with this id [%d] not exists.", userId.id));
    }
    return user;
  }
  public void joinToChatRoom(Token token, UserId userId, ChatRoomId chatRoomId)
      throws AuthenticationException, UserNotFoundException, ChatRoomNotFoundException {

    LOG.info(format("Join user with id[%d] into chat-room with id[%d].", userId.id, chatRoomId.id));

    ChatRoom chatRoom = getChatRoom(chatRoomId);
    User user = getUser(userId);

    user.getChatRooms().add(chatRoom);
    userRepository.save(user);

    LOG.info(
        format(
            "Joined user with id[%d] into chat-room with id[%d] was successfully.",
            userId.id, chatRoomId.id));
  }