working with parent category. Refactoring