public static void gameEnded(EntityManager manager, Game game, Result result)
			throws Exception {
		GamesArchive archivedGame = new GamesArchive(game, result);
		EntityTransaction transaction = manager.getTransaction();
		try {
			if (!TxtChessUtil.isAI_Game(game)) {
				ChessUser white = manager
						.find(ChessUser.class, game.getWhite());
				ChessUser black = manager
						.find(ChessUser.class, game.getBlack());
				EloRating.adjust(white, black, result);
				switch (result.getStatus()) {
				case DRAW: {
					white.drawn();
					black.drawn();
					break;
				}
				case BLACK_WINS: {
					black.won();
					white.lost();
					break;
				}

				case WHITE_WINS: {
					white.won();
					black.lost();
					break;
				}
				default: {
					throw new Exception("UNRECOGNIZED ERROR");
				}
				}
				manager.merge(white);
				manager.merge(black);
			}
			manager.persist(archivedGame);
			transaction.begin();
			manager.remove(game);
			transaction.commit();
		} catch (Exception e) {
			try {
				transaction.rollback();
			} catch (Exception ex) {
				ex.printStackTrace();
			}
			throw new Exception(
					"Unable to Archive or end the game (Internal Error)", e);
		}

	}