This piece of code is in many of my methods, in a certain area of the codebase. It's not violating DRY since its a bit different for every method. But it still bothers me that 5-8 lines of code like this is in every method.