How to model nested categories?

I suspect it’s paid work and thus confidential but if it accidentally is not then I’d absolutely love to see the code. Sounds like it’s extremely handy.