Remove duplicate code. use Utility.hasConnectivity()