This logic should go into `NetworkService`