This fix removes code duplication and consolidates networkIsRemoved into one place. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>