Purging Material Assets Using the Revit API the Right Way

I was asked about a problematic Revit model with 57,000 purgeable material assets. “Just purge them”, you say, but the problem is that even using a shift+click to select the assets locked up the user’s Revit for around 30 minutes while Revit thought about its life choices. I had experience previously purging elements using the performance advisor, but that doesn’t…