/// <summary>
        /// Proxy function that processes the selected color and sends it to the Game host
        /// </summary>
        /// <param name="color"></param>
        /// <param name="effects"></param>
        public async Task SendColorToHost(string color, SpecialCardActions effects)
        {
            ServerGameSession session = MvcApplication.Manager.FindSessionByClientConnectionId(Context.ConnectionId);

            if (session != null)
            {
                PlayerObject player = session.game.Players.FirstOrDefault(n => n.connid == Context.ConnectionId);
                if (player != null)
                {
                    switch (color)
                    {
                    case "green":
                    case "yellow":
                    case "red":
                    case "blue":
                        await session.UpdateColorInHost(player, color, effects);

                        break;

                    case "error":
                    default:
                        await session.UpdateColorInHost(player, null, null);

                        break;
                    }
                }
            }
        }
        /// <summary>
        /// Proxy function that is called after a user picks a color, the function checks if it needs to send cards from the draw four card.
        /// </summary>
        /// <param name="game">game object</param>
        /// <param name="effects">the effects object</param>
        /// <returns></returns>
        public async Task HandleSpecialAfterColorPick(UnoGame game, SpecialCardActions effects)
        {
            ServerGameSession sGame = MvcApplication.Manager.FindSessionByConnectionId(Context.ConnectionId);

            if (effects.sendColorWheel)
            {
                if (effects.cardDrawAmount != 0)
                {
                    //send the NEXT client the amount of cards.
                    game.CurrentPlayer = GetNextPlayerId(game, null);
                    string targetPlayer = new string(game.CurrentPlayer.ToCharArray());
                    game.CurrentPlayer = GetNextPlayerId(game, null);
                    await PushGame(game);

                    Clients.Caller.drawCardFromSpecial(targetPlayer, effects.cardDrawAmount);
                }
                else
                {
                    game.CurrentPlayer = GetNextPlayerId(game, null);
                }

                await PushGame(game);

                //set the current playing name:
                await MvcApplication.Manager.FindSessionByConnectionId(Context.ConnectionId).UpdateCurrentPlayingName(game.Players.FirstOrDefault(n => n.id == game.CurrentPlayer));
            }
        }
        /// <summary>
        /// Proxy function that is called when an Action card is used in the game, the function decides what the game should do.
        /// </summary>
        /// <param name="game">current game object</param>
        /// <param name="effects">effects object</param>
        /// <returns></returns>
        public async Task HandleSpecialCard(UnoGame game, SpecialCardActions effects)
        {
            ServerGameSession sGame         = MvcApplication.Manager.FindSessionByConnectionId(Context.ConnectionId);
            string            currentPlayer = game.CurrentPlayer;

            if (effects.sendColorWheel)
            {
                //send the colorwheel update to the current client.
                //after receiving the color wheel update advance the turn
                await sGame.ShowColorWheelInClient(effects);
            }
            else if (effects.cardDrawAmount != 0)
            {
                //send the NEXT client the amount of cards.
                game.CurrentPlayer = GetNextPlayerId(game, null);
                string targetPlayer = new string(game.CurrentPlayer.ToCharArray());
                game.CurrentPlayer = GetNextPlayerId(game, null);
                await PushGame(game);

                await Clients.Caller.drawCardFromSpecial(targetPlayer, effects.cardDrawAmount);
            }
            else if (effects.skipNextPerson)
            {
                //the skip is handled in code
                game.CurrentPlayer = GetNextPlayerId(game, effects);
            }
            else if (effects.reverseOrder)
            {
                game.DirectionClockwise = !game.DirectionClockwise;
                if (game.Players.Count > 2)
                {
                    game.CurrentPlayer = GetNextPlayerId(game, null);
                }
            }
            int drawCards = CheckUno(game, currentPlayer);

            await PushGame(game);

            //set the current playing name:
            PlayerObject pObject = game.Players.FirstOrDefault(n => n.id == game.CurrentPlayer);
            await MvcApplication.Manager.FindSessionByConnectionId(Context.ConnectionId).UpdateCurrentPlayingName(pObject);

            if (drawCards > 0)
            {
                await Clients.Caller.drawCardFromSpecial(currentPlayer, drawCards);
            }
            else if (drawCards == -69)
            {
                await Clients.Caller.gameWon(currentPlayer);
            }
        }
        /// <summary>
        /// Local function that takes the current game and gives you the next player in turn.
        /// </summary>
        /// <param name="game">current game object</param>
        /// <param name="effects">effects object</param>
        /// <returns></returns>
        private string GetNextPlayerId(UnoGame game, SpecialCardActions effects)
        {
            int currentPlayerIndex = game.Players.FindIndex(n => n.id == game.CurrentPlayer);

            if (effects == null)
            {
                if (game.DirectionClockwise)
                {
                    int newPlayerId = (game.Players.Count > (currentPlayerIndex + 1)) ? currentPlayerIndex + 1 : 0;
                    return(game.Players[newPlayerId].id);
                }
                else
                {
                    int newPlayerId = ((currentPlayerIndex - 1) >= 0) ? currentPlayerIndex - 1 : game.Players.Count - 1;
                    return(game.Players[newPlayerId].id);
                }
            }
            else if (effects.skipNextPerson)
            {
                if (game.DirectionClockwise)
                {
                    int newPlayerId = currentPlayerIndex + 1;
                    newPlayerId = (game.Players.Count > newPlayerId) ? newPlayerId : 0;
                    newPlayerId++;                     //adds the skip
                    newPlayerId = (game.Players.Count > newPlayerId) ? newPlayerId : 0;
                    return(game.Players[newPlayerId].id);
                }
                else
                {
                    int newPlayerId = currentPlayerIndex - 1;
                    newPlayerId = (newPlayerId >= 0) ? newPlayerId : game.Players.Count - 1;
                    newPlayerId--;                     //adds the skip
                    newPlayerId = (newPlayerId >= 0) ? newPlayerId : game.Players.Count - 1;
                    return(game.Players[newPlayerId].id);
                }
            }

            throw new Exception("Passed an effect object without enabling special effects.");
        }