public IHttpActionResult RequestCommand() { AuthResult auth = authorizeAndVerifyGameStart(); if (auth.result != null) { return(auth.result); } var gameModel = auth.game; var game = gameModel.getGame(); var player = auth.player; bool isTurn = isPlayerTurn(game, player); Command command = CommandInterface.GetCommand(gameModel, player); if (isTurn) { if (CommandInterface.GetCommandForPlayer(player.Name) == null) { command = new Command { command = CommandType.TakeTurn }; CommandInterface.SetCommandForPlayer(player.Name, command); } } return(Ok(command)); }