private void referenceRecursively(DrawNode drawNode) { drawNode.Reference(); if (!(drawNode is ICompositeDrawNode composite)) { return; } foreach (var child in composite.Children) { referenceRecursively(child); } }