update controller to optimize codes by implement  have before_action