public override async Task <bool> ProcessRule(Enrollee enrollee)
        {
            if (enrollee.Certifications == null || !enrollee.Certifications.Any())
            {
                // No certs to verify
                return(true);
            }

            bool passed = true;

            foreach (var cert in enrollee.Certifications.Where(c => c.License.Validate))
            {
                if (cert.License.PrescriberIdType == PrescriberIdType.Optional && cert.PractitionerId == null)
                {
                    continue;
                }

                var licenceNumber = cert.License.PrescriberIdType.HasValue
                    ? cert.PractitionerId
                    : cert.LicenseNumber;

                var licenceText = $"{cert.License.Prefix}-{licenceNumber}";

                PharmanetCollegeRecord record = null;
                try
                {
                    record = await _collegeLicenceClient.GetCollegeRecordAsync(cert.License.Prefix, licenceNumber);
                }
                catch (PharmanetCollegeApiException)
                {
                    enrollee.AddReasonToCurrentStatus(StatusReasonType.PharmanetError, licenceText);
                    passed = false;
                    continue;
                }
                if (record == null)
                {
                    enrollee.AddReasonToCurrentStatus(StatusReasonType.NotInPharmanet, licenceText);
                    passed = false;
                    continue;
                }

                if (!record.MatchesEnrolleeByName(enrollee))
                {
                    enrollee.AddReasonToCurrentStatus(StatusReasonType.NameDiscrepancy, $"{licenceText} returned \"{record.FirstName} {record.LastName}\".");
                    passed = false;
                }
                if (record.DateofBirth.Date != enrollee.DateOfBirth.Date)
                {
                    enrollee.AddReasonToCurrentStatus(StatusReasonType.BirthdateDiscrepancy, $"{licenceText} returned {record.DateofBirth:d MMM yyyy}");
                    passed = false;
                }
                if (record.Status != "P")
                {
                    enrollee.AddReasonToCurrentStatus(StatusReasonType.Practicing, licenceText);
                    passed = false;
                }
            }

            return(passed);
        }
        public override async Task <bool> ProcessRule(Enrollee enrollee)
        {
            if (enrollee.Certifications == null || !enrollee.Certifications.Any())
            {
                // No certs to verify
                return(true);
            }

            bool passed = true;

            foreach (var cert in enrollee.Certifications.Where(c => c.License.Validate))
            {
                PharmanetCollegeRecord record = null;
                try
                {
                    record = await _collegeLicenceClient.GetCollegeRecordAsync(cert);
                }
                catch (PharmanetCollegeApiException)
                {
                    enrollee.AddReasonToCurrentStatus(StatusReasonType.PharmanetError, $"{cert.FullLicenseNumber}");
                    passed = false;
                    continue;
                }
                if (record == null)
                {
                    enrollee.AddReasonToCurrentStatus(StatusReasonType.NotInPharmanet, $"{cert.FullLicenseNumber}");
                    passed = false;
                    continue;
                }

                if (!record.MatchesEnrolleeByName(enrollee))
                {
                    enrollee.AddReasonToCurrentStatus(StatusReasonType.NameDiscrepancy, $"{cert.FullLicenseNumber} returned \"{record.firstName} {record.lastName}\".");
                    passed = false;
                }
                if (record.dateofBirth.Date != enrollee.DateOfBirth.Date)
                {
                    enrollee.AddReasonToCurrentStatus(StatusReasonType.BirthdateDiscrepancy, $"{cert.FullLicenseNumber} returned {record.dateofBirth.ToString("d MMM yyyy")}");
                    passed = false;
                }
                if (record.status != "P")
                {
                    enrollee.AddReasonToCurrentStatus(StatusReasonType.Practicing, $"{cert.FullLicenseNumber}");
                    passed = false;
                }
            }

            return(passed);
        }