Revert "Optimize the GetDescendants and GetAncestors methods"

This reverts commit 456fe806eb969f138d9d4becc2327f7d8efeace6.