private void insertInTransaction(List<Category> categories) {
   if (categories == null) return;
   for (Category category : categories) {
     if (category.id <= 0) continue;
     db.reInsertCategory(category);
     if (category.hasChildren()) {
       insertInTransaction(category.children);
     }
   }
 }
 public void insertInTransaction(CategoryTree tree) {
   db.db().delete("category", null, null);
   db.reInsertCategory(Category.splitCategory(context));
   db.reInsertCategory(Category.noCategory(context));
   insertInTransaction(tree.getRoot().children);
 }