private void FixupZigBeeDeviceType(ZigBeeDeviceType previousValue) { if (previousValue != null && previousValue.ZigBeeDevices.Contains(this)) { previousValue.ZigBeeDevices.Remove(this); } if (ZigBeeDeviceType != null) { if (!ZigBeeDeviceType.ZigBeeDevices.Contains(this)) { ZigBeeDeviceType.ZigBeeDevices.Add(this); } if (ZigBeeDeviceTypeId != ZigBeeDeviceType.ZigBeeDeviceTypeId) { ZigBeeDeviceTypeId = ZigBeeDeviceType.ZigBeeDeviceTypeId; } } else if (!_settingFK) { ZigBeeDeviceTypeId = null; } }