We'll create fresh WordPress site with Category class installed. You have 20 minutes to test the plugin after that site we'll be deleted.
With this class (singleton), you will be able to do a lot of things with your categories.
There is a lot of methods available to do what you need, what you want to do.
If a method is missing, thanks to tell me and I will add it, if possible.