private void SubmitLeadForEventOccurrence(string eventTitle, string businessUnitId, DataProxyBase dataProxy, PublicModels.EventCartView.EventCartView viewSettings, IDictionary<string, string> parameters)
        {
            // Read/validate settings
            var settings = LeadManagementHelper.ReadSettings(dataProxy);

            if (string.IsNullOrEmpty(settings.ClientId))
                return;

            if (string.IsNullOrEmpty(businessUnitId))
                businessUnitId = settings.EventRegistrationBusinessUnitId;

            var attendee = viewSettings.PrimaryAttendee;

            var lead = new BrightWhistleLead();
            lead.SetFieldValue(BrightWhistleFields.BusinessUnitId, businessUnitId);
            lead.SetFieldValue(BrightWhistleFields.LeadSource, "Event Registration");
            lead.SetFieldValue(BrightWhistleFields.FirstName, attendee.FirstName);
            lead.SetFieldValue(BrightWhistleFields.LastName, attendee.LastName);
            lead.SetFieldValue(BrightWhistleFields.Email, attendee.Email);
            lead.SetFieldValue(BrightWhistleFields.PhoneNumber, attendee.Phone);
            lead.SetFieldValue(BrightWhistleFields.Street1, attendee.Address1);
            lead.SetFieldValue(BrightWhistleFields.Street2, attendee.Address2);
            lead.SetFieldValue(BrightWhistleFields.City, attendee.City);
            lead.SetFieldValue(BrightWhistleFields.State, attendee.State);
            lead.SetFieldValue(BrightWhistleFields.Zip, attendee.PostalCode);
            lead.SetFieldValue("EventTitle", eventTitle);

            LeadManagementHelper.SubmitLeadDataAsync(lead, dataProxy, viewSettings, parameters);
        }
        private void SubmitLead(DataProxyBase dataProxy, PublicModels.ProviderAppointmentView.ProviderAppointmentView viewSettings, IDictionary<string, string> parameters)
        {
            var settings = LeadManagementHelper.ReadSettings(dataProxy);

            if (string.IsNullOrEmpty(settings.ClientId))
                return;

            var patient = viewSettings.Patient;
            var lead = new BrightWhistleLead();

            lead.SetFieldValue(BrightWhistleFields.UniqueId, Guid.NewGuid().ToString());
            lead.SetFieldValue(BrightWhistleFields.BusinessUnitId, settings.ProviderAppointmentRequestBusinessUnitId);
            lead.SetFieldValue(BrightWhistleFields.LeadSource, "Appointment Request");
            lead.SetFieldValue(BrightWhistleFields.FirstName, patient.FirstName);
            lead.SetFieldValue(BrightWhistleFields.LastName, patient.LastName);
            lead.SetFieldValue(BrightWhistleFields.Email, patient.Email);
            lead.SetFieldValue(BrightWhistleFields.PhoneNumber, patient.Phone);
            lead.SetFieldValue(BrightWhistleFields.Street1, patient.Address1);
            lead.SetFieldValue(BrightWhistleFields.Street2, patient.Address2);
            lead.SetFieldValue(BrightWhistleFields.City, patient.City);
            lead.SetFieldValue(BrightWhistleFields.State, patient.State);
            lead.SetFieldValue(BrightWhistleFields.Zip, patient.PostalCode);
            lead.SetFieldValue(BrightWhistleFields.DateOfBirth, patient.DateOfBirth);
            lead.SetFieldValue("MiddleName", patient.MiddleName);
            lead.SetFieldValue("Gender", patient.Gender);
            lead.SetFieldValue("PatientStatus", patient.PatientStatus);
            lead.SetFieldValue("PreferredContactMethod", patient.ContactMethod);
            lead.SetFieldValue("Specialty", viewSettings.Specialty);
            lead.SetFieldValue("RequestedPhysician", viewSettings.ProviderName);
            lead.SetFieldValue("PreferredLocation", viewSettings.Location);
            lead.SetFieldValue("Insurance", viewSettings.Insurance);
            lead.SetFieldValue("AppointmentDate", viewSettings.AppointmentDate);
            lead.SetFieldValue("GroupNumber", viewSettings.GroupNumber);
            lead.SetFieldValue("MemberId", viewSettings.MemberId);
            lead.SetFieldValue("SymptomsOrComments", viewSettings.Comments);

            LeadManagementHelper.SubmitLeadDataAsync(lead, dataProxy, viewSettings, parameters);
        }