public static int CheckForXmlSamplingRejections(DateTime rejectionDate)
        {
            int newRejections = 0;

            try
            {
                MIGRATION_ERROR_REPORTTableAdapter ta = new MIGRATION_ERROR_REPORTTableAdapter();
                ta.Connection.ConnectionString = ValidatorDb.SdwisConString;
                ta.Fill(SdwisDataset.MIGRATION_ERROR_REPORT, rejectionDate);

                if (SdwisDataset.MIGRATION_ERROR_REPORT.Rows.Count > 0)
                {
                    newRejections = SdwisDataset.MIGRATION_ERROR_REPORT.Rows.Count;
                    foreach (DataRow errorReport in SdwisDataset.MIGRATION_ERROR_REPORT.Rows)
                    {
                        var labSampleNumber  = errorReport["b_lab_sample_num"];
                        var pwsid            = errorReport["b_pws_number"];
                        var labIdNumber      = errorReport["b_lab_id_number"];
                        var analyteCode      = errorReport["b_analyte_cd"];
                        var errorCode        = errorReport["b_error_cd"];
                        var errorDescription = errorReport["b_error_desc"];

                        //TODO sometime XML Sampling has errors with no lab sample Id, and we should probably know about them,
                        //     but without that we have no way of connecting the error with the sample in our database
                        if (labSampleNumber == null || labSampleNumber == DBNull.Value || pwsid == null || pwsid == DBNull.Value ||
                            errorDescription != null && errorDescription.ToString().Contains("FLAG"))
                        {
                            continue;
                        }
                        if (!string.IsNullOrWhiteSpace((string)labSampleNumber))
                        {
                            //if(analyteCode == null || string.IsNullOrWhiteSpace((string)analyteCode))
                            //{
                            //Sample
                            Sample sample = db.CmdpSamples
                                            .Where(s => s.PWSIdentifier == (string)pwsid && s.LabSampleIdentifier == (string)labSampleNumber)
                                            .OrderByDescending(s => s.XmlCompilationDate)
                                            .FirstOrDefault();
                            if (sample != null)
                            {
                                sample.AddError(errorDescription.ToString(), false, true);
                                sample.XmlSamplingValidationDate = DateTime.Now;
                                db.SaveChanges();
                            }

                            /*}
                             * else
                             * {
                             *  //Sample Result
                             *  Result sampleResult = db.CmdpResults
                             *                  .Where(r => r.PWSIdentifier == (string)pwsid
                             *                      && r.LabSampleIdentifier == (string)labSampleNumber
                             *                      && r.AnalyteCode == (string)analyteCode)
                             *                  .OrderByDescending(r => r.XmlCompilationDate)
                             *                  .FirstOrDefault();
                             *  if (sampleResult != null)
                             *  {
                             *      sampleResult.AddError(errorDescription.ToString(), false, true);
                             *      sampleResult.XmlSamplingValidationDate = DateTime.Now;
                             *      db.SaveChanges();
                             *  }
                             * }*/
                        }
                    }
                }
            }
            catch (Exception e)
            {
                //TODO something more meaningful here
                throw;
            }
            return(newRejections);
        }