Refactored the way of sending response in controller actions.