Refactor create_common_response to avoid goto.