I still would like someone to come up with an abstraction for this, since it appears many places in the code base now.  Any takers?  I'll create an issue for it.