private bool CheckHubExists(string resourceGroupName, string dataFactoryName, string hubName) { try { PSHub hub = this.GetHub(resourceGroupName, dataFactoryName, hubName); return true; } catch (CloudException e) { if (e.Response.StatusCode == HttpStatusCode.NotFound) { return false; } throw; } } }