I could be wrong but I feel like I've seen this code before in some other place. Perhaps I'm wrong but would you mind taking a couple of seconds to hunt for it and if it does appear elsewhere refactor it so that it's only done in one place.