public void updateCategory(CategoryData categoryData) {
   Category category = categoryService.find(UUIDHelper.stringToUUID(categoryData.getUuid()));
   if (categoryData.getParentCategory() != null) {
     log.info("found parent category");
     category.setParentCategory(
         categoryService.find(
             UUIDHelper.stringToUUID(categoryData.getParentCategory().getUuid())));
   }
   categoryService.update(category);
 }
 @Override
 public List<CategoryData> getCategories() {
   List<CategoryData> categories = new ArrayList<CategoryData>();
   for (Category category : categoryService.findAll())
     categories.add(CategoryData.convertCategory(category));
   return categories;
 }
 @Override
 public void saveCategory(CategoryData categoryData) {
   if (categoryData.getParentCategory() == null)
     categoryService.addCategory(categoryData.getCategoryEntity());
   else {
     Category parent =
         categoryService.find(UUIDHelper.stringToUUID(categoryData.getParentCategory().getUuid()));
     Category child =
         new Category(
             UUIDHelper.stringToUUID(categoryData.getUuid()),
             categoryData.getCategoryName(),
             parent);
     categoryService.addCategory(child);
     categoryService.addParentCategory(
         child.getUuid(), UUIDHelper.stringToUUID(categoryData.getParentCategory().getUuid()));
   }
 }
 public void removeCategory(CategoryData categoryData) {
   Category category = categoryService.find(UUIDHelper.stringToUUID(categoryData.getUuid()));
   categoryService.removeCategory(category);
 }