See how updateNetworkNamespace link - in fact, let's just move this code into there.