Same as above. Not sure if it makes sense to refactor the logic into a single utility method, since doing so may make the code less obvious.