Sorry. I know you were looking for a cleaner way of doing it but if I were in your situation, i'd stick the above in a View and use that.