That’s definitely doable, I don’t have a method that does that exactly, but here is a close one. That demonstrates searching through assets and manipulating references.
@eilsoe that’s an unofficial API so make sure to backup your project first! I think you can definitely build a method that does exactly what you are asking for. If you have any issue ask again.