Parse response in separate function for unit testing