@Override
	public ServerModel discardCards(DiscardCardsRequest request, CookieParams cookie) throws InvalidMovesRequest{
		if(request == null) {
			throw new InvalidMovesRequest("Error: invalid discard cards request");
		} 
		
		ServerModel serverGameModel = serverModels.get(cookie.getGameID());
		
		serverGameModel.getBank().brick += request.getDiscardedCards().getBrick();
		serverGameModel.getBank().ore += request.getDiscardedCards().getOre();
		serverGameModel.getBank().sheep += request.getDiscardedCards().getSheep();
		serverGameModel.getBank().wheat += request.getDiscardedCards().getWheat();
		serverGameModel.getBank().wood += request.getDiscardedCards().getWood();
		
		
		Player player = serverGameModel.getPlayers().get(request.getPlayerIndex());
		int playerBrick = player.getBrick() - request.getDiscardedCards().getBrick();
		int playerOre = player.getOre() - request.getDiscardedCards().getOre();
		int playerSheep = player.getSheep() - request.getDiscardedCards().getSheep();
		int playerWheat = player.getWheat() - request.getDiscardedCards().getWheat();
		int playerWood = player.getWood() - request.getDiscardedCards().getWood();
		
		player.setBrick(playerBrick);
		player.setOre(playerOre);
		player.setSheep(playerSheep);
		player.setWheat(playerWheat);
		player.setWood(playerWood);

		
		if (!serverGameModel.getPlayers().get(player.getPlayerIndex()).isDiscarded()) {
			serverGameModel.getPlayers().get(player.getPlayerIndex()).setDiscarded(true);
		}
		
		if (serverGameModel.getPlayers().get(0).isDiscarded() && 
				serverGameModel.getPlayers().get(1).isDiscarded() && 
				serverGameModel.getPlayers().get(2).isDiscarded() && 
				serverGameModel.getPlayers().get(3).isDiscarded()) {
			
			serverGameModel.getTurnTracker().setStatus("Robbing");
			serverGameModel.getPlayers().get(0).setDiscarded(false);
			serverGameModel.getPlayers().get(1).setDiscarded(false);
			serverGameModel.getPlayers().get(2).setDiscarded(false);
			serverGameModel.getPlayers().get(3).setDiscarded(false);
		}
		
		serverGameModel.incrementVersion();
		
		return serverGameModel;
	}