[DiagramModelUtils] Use a combination of recursive and by reference methods

* The recursive methods are slower but safer for operations like delete