protected void getCategories(JSONObject project, String parentName, String parentId,
			JSONArray categoriesArray) {
		Iterator i = categoriesArray.iterator();

		if (parentName.equals("")) {
			getObjectsFromCategory(project, null, "");
		}
		

		while (i.hasNext()) {
			JSONObject category = (JSONObject) i.next();
			

			if (category.get("parent-id").equals(parentId)) {
				if (cm.isPageInDownloadedList(category.getString("name"))) {
					category = pageWasCreatedBefore(project, category, parentName);
				}
				else {
					cm.createPage(project.getString("name"), category.getString("name"), parentName, chosenCategory);
					if(cm.pageWasCreatedBefore(project.getString("name"), category.getString("name"))) {
						cm.addNewPageToList(category.getString("name"));
					}
				}
				getObjectsFromCategory(project, category, "");
				getCategories(project, category.getString("name"), category.getString("id"),
						categoriesArray);
			}
		}
	}