Reduce code duplication for the hierarchic iterator and remove friendship with entity
changed the description
merged
mentioned in commit ab0eb0f5