Move validating api response out of controller