Adding a class to a hierarchy of parent child-dimensional array.