/**
  * finds the active player from a list of players
  *
  * @param players
  * @return
  */
 private PlayerBean getActivePlayerFromList(List players) {
   for (Iterator playerIter = players.iterator(); playerIter.hasNext(); ) {
     PlayerBean pb = (PlayerBean) playerIter.next();
     if (pb.getIsActive().booleanValue()) {
       return pb;
     }
   }
   return null;
 }
  /**
   * sets the next active players according to num iterations.
   *
   * @param currentActivePlayer
   * @param activeIterations
   * @param gamePK
   * @return
   */
  public PlayerBean setActivePlayer(Long currentActivePlayer, int activeIterations, Long gamePK) {
    List tablePlayers = getPlayersByGame(gamePK, true);
    PlayerBean activePlayer = getActivePlayerFromList(tablePlayers);
    PlayerBean newActivePlayer = activePlayer;
    int index = tablePlayers.indexOf(activePlayer);
    for (int i = 0; i < activeIterations; i++) {
      // if this is the last player in the list
      if (tablePlayers.size() - 1 == index) index = 0;
      else index++;
      newActivePlayer = (PlayerBean) tablePlayers.get(index);
    }
    if (newActivePlayer != null && activePlayer.getTechkey() != newActivePlayer.getTechkey()) {
      activePlayer.setIsActive(Boolean.FALSE);
      updatePlayer(activePlayer);
      newActivePlayer.setIsActive(Boolean.TRUE);
      updatePlayer(newActivePlayer);
    }

    return newActivePlayer;
  }
 public void setPlayerReady(PlayerBean pb) {
   pb.setIsReady(Boolean.TRUE);
   updatePlayer(pb);
 }