Recursive deletion

Hello,

I am wondering how the recursive deletion works within Elgg and if there is perhaps any documentation for this. By recursive deletion I mean how deleting an entity deletes entities that are linked to it. I am looking for an explanation of the code/where that functionality is located in the class structure. Thanks!