Move response body to a private method

This is done to improve clarity of the code.