public double LeaveChair(Player player)
 {
     if (TableLocationOfActivePlayers.Values.Contains(player))
     {
         foreach (var chair in TableLocationOfActivePlayers.Keys)
         {
             if (TableLocationOfActivePlayers[chair] == player)
             {
                 TableLocationOfActivePlayers.Remove(chair);
                 ActivePlayersByID.Remove(player.GetHashCode());
                 chair.Release();
                 return(player.StandUp());
             }
         }
     }
     throw new PlayerNotFoundException("Can't find player at the table");
 }
        /// <summary>
        /// Converting passive player to active player.
        /// precondition: the player must be a passive player at the room.
        /// postcondition: the player is active player at the room.
        /// </summary>
        /// <param name="player">a passive player at the room</param>
        public void JoinPlayerToTable(Player player, double buyIn)
        {
            if (player.CurrentState != Player.State.Passive)
            {
                throw new PlayerModeException("Player is not a spectator");
            }

            ActivePlayersByID.Add(player.GetHashCode(), player);

            player.JoinToTable(buyIn);

            if (ActivePlayers.Count >= Preferences.MinNumberOfPlayers)
            {
                Monitor.Enter(_lock);
                Monitor.PulseAll(_lock);
                Monitor.Exit(_lock);
            }
        }