@Override
	public JSONObject main(Map<String, String> params, Session session)
			throws Exception {
		
		JSONObject rtn = new JSONObject();
		long activeUserId = session.getActiveUserId();
		long appointmentId = Long.valueOf(params.get("id"));
		Appointment a = Appointment.findById(appointmentId);
		if(a==null){
			rtn.put("rtnCode", this.getRtnCode(405));
			return rtn;
		}
		
		if(a.isConflictWithUser(activeUserId)) {
			rtn.put("rtnCode", this.getRtnCode(406));
			return rtn;
		}
		
		if(!a.aWaitingId.contains(activeUserId)) {
			rtn.put("rtnCode", this.getRtnCode(407));
			return rtn;
		}
		
		a.addAcceptedUser(activeUserId);
		a.save();
		rtn.put("rtnCode", this.getRtnCode(200));
		return rtn;
	}