private List<User> getOnlineFriendsForUser(com.is.chatmultimedia.models.User user) {
    List<User> onlineFriends = new ArrayList<User>();
    Collection<Friend> allFriends = user.getFriends();
    User aUser = null;
    for (Friend it : allFriends) {
      aUser = userManager.getUserByUsername(it.getUsername());
      if (aUser != null) { // user is online
        onlineFriends.add(aUser);
        it.setIsOnline(true);
      }
    }
    return onlineFriends;
  }