Move network add/remove operations to a common function
am: 950bec9c63

Change-Id: Id307759e9a6cef132f6336f76f0b5644aac78a77