private async Task <MicrosoftDynamicsCRMspiceMinistryemployee> ObtainContact(IDynamicsClient dynamicsClient, ILogger logger)
        {
            var contact = await DynamicsUtility.GetContactAsync(dynamicsClient, Contact);

            if (contact == null)
            {
                try
                {
                    contact = await DynamicsUtility.CreateContactAsync(dynamicsClient, Contact, ProgramArea);

                    logger.LogInformation("Successfully created contact {ContactId} from view model {@Contact}", contact.SpiceMinistryemployeeid, Contact);
                }
                catch (OdataerrorException ex)
                {
                    logger.LogError(ex, string.Join(Environment.NewLine, "Failed to create contact from view model {@Contact}", "{@ErrorBody}"), Contact, ex.Body);
                    throw;
                }
            }
            else
            {
                logger.LogInformation("Successfully retrieved existing contact {ContactId} from view model {@Contact}", contact.SpiceMinistryemployeeid, Contact);
            }

            return(contact);
        }
        private async Task <MicrosoftDynamicsCRMspiceMinistryemployee> ObtainSubmitter(IDynamicsClient dynamicsClient, ILogger logger, User user, string programAreaId)
        {
            // Submitter is now a ministry employee
            Contact contact = new Contact()
            {
                Email = user.Email, FirstName = user.GivenName, LastName = user.Surname
            };

            var submitter = await DynamicsUtility.GetContactAsync(dynamicsClient, contact);

            if (submitter == null)
            {
                try
                {
                    submitter = await DynamicsUtility.CreateContactAsync(dynamicsClient, contact, programAreaId);

                    logger.LogInformation("Successfully created contact {ContactId} from view model {@Contact}", submitter.SpiceMinistryemployeeid, contact);
                }
                catch (OdataerrorException ex)
                {
                    logger.LogError(ex, string.Join(Environment.NewLine, "Failed to create contact from view model {@Contact}", "{@ErrorBody}"), contact, ex.Body);
                    throw;
                }
            }
            else
            {
                logger.LogInformation("Successfully retrieved existing contact {ContactId} from view model {@Contact}", submitter.SpiceMinistryemployeeid, contact);
            }

            return(submitter);
        }