You should refactor this query after the one line conditional to the user class. It doesn't quite feel like the right place to put this.