private void CloseHosts() { networkModel.SaveNetworkModel(); if (hosts == null || hosts.Count == 0) { throw new Exception("Network Model Services can not be closed because it is not initialized."); } foreach (ServiceHost host in hosts) { host.Close(); } string message = "The Network Model Service is gracefully closed."; Logger.LogInfo(message); Console.WriteLine("\n\n{0}", message); }