Please factor this into a helper method, I've seen it re-invented several times in different pull requests, so time to factor, test and use once everywhere