Refactor: Extract response handling into helper method