TRUNK-2707: Fixxed bug where a parent could be its own child