I am trying to get first level category from current category ID in my controller . For example- I have
Maincategory
SubCategory1
SubCategory2
SubChild1
SubChild2.
I want to access Maincategory in my controller whether my current catgeory id is SubChild1 or it's SubCategory1.
How can I do this?