public String move() {
try {
WeblogManager wmgr = WebloggerFactory.getWeblogger().getWeblogManager();
log.debug("Moving categories to category - "+getTargetCategoryId());
// Move subCategories to new category.
String[] cats = getSelectedCategories();
WeblogCategory parent = wmgr.getWeblogCategory(getTargetCategoryId());
if(cats != null) {
for (int i = 0; i < cats.length; i++) {
WeblogCategory cd =
wmgr.getWeblogCategory(cats[i]);
// Don't move category into itself.
if (!cd.getId().equals(parent.getId()) &&
!parent.descendentOf(cd)) {
wmgr.moveWeblogCategory(cd, parent);
} else {
addMessage("categoriesForm.warn.notMoving", cd.getName());
}
}