Move repeated logic from different helpers into one - application_helper.rb