Moving set_object method into application controller
This reduces some code duplication.