public async Task <bool> ConnectionExistsAsync(string connectionId, CancellationToken cancellationToken = default) { if (string.IsNullOrEmpty(connectionId)) { throw new ArgumentException(NullOrEmptyStringErrorMessage, nameof(connectionId)); } var exists = false; var api = await _restApiProvider.GetCheckConnectionExistsEndpointAsync(_appName, _hubName, connectionId); await _restClient.SendAsync(api, HttpMethod.Head, _productInfo, handleExpectedResponse : response => { switch (response.StatusCode) { case HttpStatusCode.OK: exists = true; return(true); case HttpStatusCode.NotFound: return(true); default: return(false); } }, cancellationToken : cancellationToken); return(exists); }