Added a generic way to cleanup invalidated UI resources via tree ownership