finally added update method to controller.