Add attached/detached methods to Nodes and call them when applying patch