This stretch of code is repeated several times, with the only variation being how the response is unpacked. Could we extract a higher level method to reduce duplication?