public boolean editDebate(Debate debate) {
		boolean flag = false;
		// Get root element
		Element debateE = document.getRootElement();
		// Adding user elements and attribute 'username'
		Element debateElement = (Element) document
				.selectSingleNode("//debate[@id='" + debate.getId() + "']");
		if (debateElement != null) {
			debateElement.element("id").setText(debate.getId());
			debateElement.element("topic").setText(debate.getTopic());
			debateElement.element("description").setText(debate.getDescription());
			debateElement.element("maxTurns").setText(debate.getMaxTurns()+"");
			debateElement.element("turnDuration").setText(debate.getTurnDuration()+"");
			debateElement.element("maxTime").setText(debate.getMaxTime());
			debateElement.element("timeLeft").setText(debate.getTimeLeft());
			debateElement.element("materials").setText(debate.getMaterials());
			debateElement.element("status").setText(debate.getStatus());
			debateElement.element("isDelete").setText(debate.getIsDelete() + "");
			debateElement.element("teamALeader").setText(debate.getTeamLeader()[0]);
			debateElement.element("teamBLeader").setText(debate.getTeamLeader()[1]);
			debateElement.element("teamARep").setText(debate.getTeamRep()[0]);
			debateElement.element("teamBRep").setText(debate.getTeamRep()[1]);
			if (debate.getCurentTurnTeam() == null) {
				debateElement.element("currentTurnTeam").setText("A");
			} else {
				debateElement.element("currentTurnTeam").setText(debate.getCurentTurnTeam());
			}
			
			if (debate.getAcceptPositionTeam() == null) {
				debateElement.element("acceptPositionTeam").setText("A");
			} else {
				debateElement.element("acceptPositionTeam").setText(debate.getAcceptPositionTeam());
			}
			// Add child elements
			
			String[][] teams = debate.getTeam();
			if (teams.length != 0) {
				String teamA = "", teamB = "";
				for (int i = 0; i < teams[0].length; i++) {
					teamA += teams[0][i] + ",";
					teamB += teams[1][i] + ",";
				}
				debateElement.element("memberA").setText(teamA);
				debateElement.element("memberB").setText(teamB);
			}
			debateElement.element("winner").setText(debate.getWinner() + "");
			
		}
		
		// Write to xml
		try {
			XmlUtils.write2Xml(fileName, document);
			flag = true;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return flag;
	}