public IQualityCheckingResult Correct(object data, IDataQualityCheckingRule rule)
        {
            var checkResult = Check(data, rule);

            var chemistryCheckingResult = new ChemistryCheckingResult();
            chemistryCheckingResult.AddResult(checkResult);

            if (checkResult.NeedCorrection)
            {
                var castedData = (IEnumerable<Core.Action>)data;
                var castedRule = (ChemistryValueCheckingRule)rule;

                foreach (ChemistryValueCheckingRuleItem ruleItem in castedRule.Items)
                {
                    // Assume only one action is present for each matching rule
                    var matchingAction = castedData.Where(x => x.ActionID.Equals(ruleItem.ActionId)).FirstOrDefault();

                    var latestVersionData = _dataVersioningHelper.GetLatestVersionActionData(matchingAction);

                    var qcResult = GenerateCorrectChemistryDataNewVersion(latestVersionData, ruleItem);

                    chemistryCheckingResult.AddResult(qcResult);
                }
            }
            else if (checkResult.Level == QualityCheckingResultLevel.Info)
            {
                return new QualityCheckingResult("Sample data meets quality checking rule. No correction is needed.", false, QualityCheckingResultLevel.Info);
            }
            else
            {
                return new QualityCheckingResult("Sample data/Data checking rule is not valid. No correction could be applied.", false, QualityCheckingResultLevel.Error);
            }

            return chemistryCheckingResult;
        }
        public IQualityCheckingResult Check(object data, IDataQualityCheckingRule rule)
        {
            var checkingResult = new ChemistryCheckingResult();

            if (!IsDataSupported(data))
            {
                return new QualityCheckingResult("Data is not supported by the Quality Checking Tool.", false, QualityCheckingResultLevel.Error);
            }
            else if (!IsDataQualityCheckingRuleSupported(rule))
            {
                return new QualityCheckingResult("Data Quality Checking Rule is not supported by the Quality Checking Tool.", false, QualityCheckingResultLevel.Error);
            }
            else
            {
                var castedData = (IEnumerable<Core.Action>)data;
                var castedRule = (ChemistryValueCheckingRule)rule;

                foreach (ChemistryValueCheckingRuleItem ruleItem in castedRule.Items)
                {
                    // Assume that only one action is present for each matching rule
                    var matchingAction = castedData.Where(x => x.ActionID.Equals(ruleItem.ActionId)).FirstOrDefault();

                    var latestVersionData = _dataVersioningHelper.GetLatestVersionActionData(matchingAction);

                    var qcResult = DoesValueMeetRuleItem(latestVersionData, ruleItem);

                    checkingResult.AddResult(qcResult);
                }
            }

            return checkingResult;
        }