Since we now do this in a couple places, it'd be awesome to pull it out into a static function or something like that.