This pattern appears twice, and I'd bet there are more places it'd be useful too.  Is there a good place to put this as a utility function, or even a method on Document? (e.g. Document.getFriendlyName()?)