private void Fixuplocality(locality previousValue) { if (previousValue != null && previousValue.addresses.Contains(this)) { previousValue.addresses.Remove(this); } if (locality != null) { if (!locality.addresses.Contains(this)) { locality.addresses.Add(this); } if (locality_id != locality.id) { locality_id = locality.id; } } else if (!_settingFK) { locality_id = null; } }