private void UpdateExistingLotAttribute(LotAttribute existingLotAttribute, AttributeName attributeName, AttributeCommonData attributeData, ChileProductAttributeRange range, double value, ref List <LotAttributeDefect> lotAttributeDefects)
            {
                if (range.ValueOutOfRange(value))
                {
                    CreateOrUpdateOpenAttributeDefect(existingLotAttribute.Lot, attributeName, value, range, ref lotAttributeDefects);
                }
                else
                {
                    CloseOpenAttributeDefects(existingLotAttribute, lotAttributeDefects);
                }

                if (Math.Abs(existingLotAttribute.AttributeValue - value) > 0.0001)
                {
                    existingLotAttribute.AttributeValue = value;
                    existingLotAttribute.Computed       = attributeData.NullTestDate;
                    existingLotAttribute.AttributeDate  = attributeData.DeterminedTestDate;
                }
            }
            private void AddNewLotAttribute(ILotAttributes oldAttributes, Lot newLot, ChileProductAttributeRange range, AttributeName attributeName, AttributeCommonData attributeData, double value, ref List <LotAttributeDefect> lotAttributeDefects)
            {
                var attribute = newLot.AddNewAttribute(oldAttributes, attributeName, attributeData, LotMother);

                if (attribute == null)
                {
                    return;
                }

                if (range.ValueOutOfRange(attribute.AttributeValue))
                {
                    LotMother.AddRead(EntityTypes.LotDefect);
                    LotMother.AddRead(EntityTypes.LotAttributeDefect);

                    CreateOrUpdateOpenAttributeDefect(newLot, attributeName, value, range, ref lotAttributeDefects);
                }
                else
                {
                    CloseOpenAttributeDefects(attribute, lotAttributeDefects);
                }
            }