public static void Remove(AddressModel address)
 {
     if (address != null && Exists(address))
     {
         // Delete
         _addresses.Remove(address);
         SetXml();
     }
 }
 public static void Add(AddressModel address)
 {
     if (address != null && !Exists(address))
     {
         // Insert
         _addresses.Add(address);
         SetXml();
     }
     else if (address != null)
     {
         // Update
         foreach (AddressModel model in _addresses.Where(w => w.Id == address.Id))
         {
             model.HostIp = address.HostIp;
             model.HostPort = address.HostPort;
             model.Favorite = address.Favorite;
             //model.Response = address.Response;
             SetXml();
         }
     }
 }
 private static bool Exists(AddressModel address)
 {
     try
     {
         return _addresses.Any(w => w.HostIp == address.HostIp &&
                                    w.HostPort == address.HostPort);
     }
     catch (Exception)
     {
         return false;
     }
 }