public HttpResponseMessage GameMove(int gameId, Move move)
        {
            var game = games.FirstOrDefault(g => g.Id == gameId);
            if (game == null)
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, "Invalid id: " + gameId);

            if (ValidMove(move, game))
            {
                game.Board[game.HSize * move.Y + move.X] = move.Player;
                game.CurrentPlayer = game.CurrentPlayer % 2 + 1;

                CheckBoardForWinner(game);

                return Request.CreateResponse(HttpStatusCode.OK, "Sweet");
            }

            return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Invalid move");
        }
 private bool ValidMove(Move move, Game game)
 {
     return ModelState.IsValid && game.Board[game.HSize * move.Y + move.X] == 0 && game.CurrentPlayer == move.Player && game.Winner == -1;
 }