Make code a bit DRYer.
Merge pull request #4608 from ADmad/3.0-controller

Make code a bit DRYer.