public static synchronized void saveRooms() throws Exception {
		Logger.log("Saving rooms...");

		File root = new File("files/tree/");
		IOUtils.deleteDir(root);
		root.mkdirs();

		for (Room room : Rooms.ROOMS) {
			File roomRoot = new File(root, room.getLabel());
			roomRoot.mkdirs();

			File roomProperties = new File(roomRoot, "room.properties");

			Properties properties = new Properties();

			properties.setProperty("label", roomRoot.getName());
			properties.setProperty("icon", room.getStringIcon());
			properties.setProperty("color", ColorUtils.getStringFromColor(room.getColor()));

			FileOutputStream fos = new FileOutputStream(roomProperties);
			properties.store(fos, "");
			fos.close();
			
			for (RoomObject obj : room.getObjects()) {
				File roomObjectFile = new File(roomRoot, obj.getLabel() + ".properties");
				
				properties = new Properties();
				
				try {
					properties.setProperty("type", obj.toString());
					properties.setProperty("hci", obj.getHci() + "");
					properties.setProperty("hcinode", obj.getHcinode() + "");
					properties.setProperty("icon", obj.getStringIcon());
					properties.setProperty("color", obj.getStringColor());
					properties.setProperty("manualon", obj.getManualOn() + "");
					properties.setProperty("manualoff", obj.getManualOff() + "");
				} catch (Exception e) {
					e.printStackTrace();
				}
				
				String jobs = "";
				
				for (RoomJob job : obj.getJobs()) {
					jobs += job.isActive() + "," + job.getCondition1() + "," + job.getCondition2() + "," + job.getCondition3() + "," + job.getHourFrom() + "," + job.getMinuteFrom() + "," + job.getHourTo() + "," + job.getMinuteTo() + "," + job.getTTL() + "," + job.getPriority() + "," + job.getAction() + "|";
				}
				
				properties.setProperty("jobs", jobs);			

				obj.save(properties);
				
				fos = new FileOutputStream(roomObjectFile);
				properties.store(fos, "");
				fos.close();
			}
		}
	}