public void saveCategory(DialogCategory category){
		category.setTitle(cleanFileName(category.getTitle()));
		if(categories.containsKey(category.getID())){
			DialogCategory currentCategory = categories.get(category.getID());
			if(!currentCategory.getTitle().equals(category.getTitle())){
				while(containsCategoryName(category.getTitle()))
					category.setTitle(category.getTitle() + "_");
				File newdir = new File(this.dir, category.getTitle());
				File olddir = new File(this.dir, currentCategory.getTitle());
				if(newdir.exists())
					return;
				if(!olddir.renameTo(newdir))
					return;
			}
			category.dialogs = currentCategory.dialogs;
		}
		else{
			if(category.getID() < 0){
				lastUsedCatID++;
				category.setID(lastUsedCatID);
			}
			while(containsCategoryName(category.getTitle()))
				category.setTitle(category.getTitle() + "_");
			File dir = new File(this.dir, category.getTitle());
			if(!dir.exists())
				dir.mkdirs();
		}
		categories.put(category.getID(), category);
	}