public void dealCards(int gameid)
        {
            Subscriber me = GetMe();

            Trace.WriteLine("SERVICE: Dealing card !!!");
            Game g         = listOfGames.ElementAt(gameid - 1);
            int  deckIndex = g.Deck.Length - 1;

            for (int i = 0; i < g.Count; i++)
            {
                ServiceCard[] cards = new ServiceCard[6];
                for (int j = 0; j < 6; j++)
                {
                    cards[j]  = g.Deck[deckIndex];
                    deckIndex = deckIndex - 1;
                }
                ServiceUser p = g.Players[i];
                p.CardsInHand = 6;
                Subscriber       s  = getSubscriberById(p.Id);
                IServiceCallback cb = s.callback;
                Trace.WriteLine("SERVICE: Calling callback ");
                Trace.WriteLine("SERVICE: Calling player " + s.nickname);
                Trace.WriteLine("SERVICE: Subscribers " + subscrbers.Count);
                cb.OnDeal(cards, g.Deck[0], g.Players[i].Id, g.Id);
                Trace.WriteLine("SERVICE: Calling back done!");
            }
            g.TopCardIndex = deckIndex;
            Trace.WriteLine("SERVICE: deal done!");
        }
        public void notifyHitMade(int gameId, ServiceCard movedCard)
        {
            Trace.WriteLine("SERVICE: notify hit made");

            Game g = listOfGames.ElementAt(gameId - 1);

            g.Players[g.HitsIndex].CardsInHand -= 1;
            g.NrOfCardsOnTable += 1;
            Trace.WriteLine("SERVICE: cards on table " + g.NrOfCardsOnTable);
            if (g.Players[g.HitsIndex].CardsInHand == 0 && g.TopCardIndex <= 0)
            {
                g.Players[g.HitsIndex].Finished = true;
                if (isGameOver(gameId))
                {
                    for (int i = 0; i < g.Count; i++)
                    {
                        int looser = getNextActivePlayerIndex(g, g.HitsIndex);

                        Subscriber       s  = getSubscriberById(g.Players[i].Id);
                        IServiceCallback cb = s.callback;
                        cb.OnGameOver(gameId, g.Players[looser].Id);
                    }

                    return;
                }
                else
                {
                    for (int i = 0; i < g.Count; i++)
                    {
                        Subscriber       s  = getSubscriberById(g.Players[i].Id);
                        IServiceCallback cb = s.callback;
                        cb.OnPlayerFinished(gameId, g.Players[g.HitsIndex].Id);
                    }
                }
            }
            if (g.NrOfCardsOnTable == 12)
            {
                setNextMoveAndHitId(gameId);
                for (int i = 0; i < g.Count; i++)
                {
                    Subscriber       s  = getSubscriberById(g.Players[i].Id);
                    IServiceCallback cb = s.callback;
                    Trace.WriteLine("SERVICE: calling round over");
                    Trace.WriteLine("SERVICE: hit index" + g.HitsIndex + " moveIndex " + g.MovesIndex);
                    cb.OnHitMade(movedCard, gameId, g.Players[g.HitsIndex].Id);
                    cb.OnRoundOver(gameId, g.Players[g.MovesIndex].Id, g.Players[g.HitsIndex].Id);
                }
            }
            else
            {
                for (int i = 0; i < g.Count; i++)
                {
                    Subscriber       s  = getSubscriberById(g.Players[i].Id);
                    IServiceCallback cb = s.callback;
                    cb.OnHitMade(movedCard, gameId, g.Players[g.HitsIndex].Id);
                }
            }
        }
        /// <summary>
        /// Sends card to the game. Severely unreasonable approach
        /// </summary>
        /// <param name="cardMoved">card moved</param>
        /// <param name="playerId">playet that made the move</param>
        /// <param name="gameId">game in view</param>
        public void notifyMove(ServiceCard cardMoved, long playerId, int gameId)
        {
            Game        g      = listOfGames.ElementAt(gameId - 1);
            ServiceUser player = getUserById(gameId, playerId);

            player.CardsInHand -= 1;
            g.NrOfCardsOnTable += 1;

            if (player.CardsInHand == 0 && g.TopCardIndex <= 0)
            {
                player.Finished = true;

                if (isGameOver(gameId))
                {
                    for (int i = 0; i < g.Count; i++)
                    {
                        ServiceUser      p  = g.Players[i];
                        Subscriber       s  = getSubscriberById(p.Id);
                        IServiceCallback cb = s.callback;

                        cb.OnGameOver(gameId, g.Players[g.HitsIndex].Id);
                        Trace.WriteLine("SERVICE: Calling back to notify Game Over!");
                    }

                    return;
                }
                else
                {
                    for (int i = 0; i < g.Count; i++)
                    {
                        ServiceUser      p  = g.Players[i];
                        Subscriber       s  = getSubscriberById(p.Id);
                        IServiceCallback cb = s.callback;

                        cb.OnPlayerFinished(gameId, playerId);
                        Trace.WriteLine("SERVICE: Calling back to notify player finished!");
                    }
                }
            }
            for (int i = 0; i < g.Count; i++)
            {
                ServiceUser      p  = g.Players[i];
                Subscriber       s  = getSubscriberById(p.Id);
                IServiceCallback cb = s.callback;

                cb.OnNotifyMove(cardMoved, gameId, playerId, g.Players[g.HitsIndex].Id);//seepärast peakski teenusele lisaks olema back endis veel üks klass
                Trace.WriteLine("SERVICE: Calling back to notify move done!");
            }
        }
        public void initGameDeck(int gameid)
        {
            Game g = listOfGames.ElementAt(gameid - 1);

            g.Deck = new ServiceCard[36];
            int cnt = 0;

            for (int s = 1; s < 5; s++)
            {
                for (int i = 6; i < 15; i++)
                {
                    ServiceCard c = new ServiceCard();
                    c.Kind      = s;
                    c.Rank      = i;
                    g.Deck[cnt] = c;
                    cnt        += 1;
                }
            }
            g.TopCardIndex = g.Deck.Length - 1;
            g.State        = 1; //game has started
        }