Refactored code when root category is created
Removed duplicate getRootId code