private function normalizeSearchChannelsResponse($response)
    {
        $response = json_decode($response, true);
        if (!is_array($response) || !array_key_exists('result', $response) || !array_key_exists('total', $response)) {
            throw new Exception('Invalid response from search endpoint');
        }

        $response['totalCount'] = $response['total'];
        $response['channels'] = $response['result'];
        unset($response['result'], $response['total']);

        return json_encode($response);
    }