Updated get categories hierarchy method