public async Task <GenericServiceResponse> GetLeadDetailed(Guid customerGuid, LogCommand logCommand) { const string method = "GetLeadDetailed"; try { logCommand.LogMessage = string.Format($"{Service}.{method} Starting input parameter leadGuid = {0}", customerGuid); _logHandler.HandleLog(logCommand); //Initialize Detailed Object, Get Lead Data. var sfLead = new SFDetailedLead { LeadData = await _leadRepository.GetDetailedLead(customerGuid, logCommand), CustomerData = await _customerRepository.GetDetailedCustomerFromGuid(customerGuid, logCommand), CapStatus = await _usageRepository.GetIsCapQualifiedFromCustomerGuid(customerGuid, logCommand), PremiseData = new List <SFDetailedPremise>() { new SFDetailedPremise() { AddressData = await _addressRepository.GetDetailedAddressFromCustomerGuid(customerGuid, logCommand) } }, UsageData = await _usageRepository.GetUsageFromCustomerGuid(customerGuid, logCommand), PrimaryContactData = new SFDetailedContact() { ContactData = await _contactRepository.GetPrimaryContactFromCustomerGuid(customerGuid, logCommand) } }; // Primary Contact Data: Phones, Emails, MailingAddresses sfLead.PrimaryContactData.ContactPhones = await _contactRepository.GetPhoneFromContactGuid(sfLead.PrimaryContactData.ContactData.ContactGuid, logCommand); sfLead.PrimaryContactData.ContactEmails = await _contactRepository.GetEmailFromContactGuid(sfLead.PrimaryContactData.ContactData.ContactGuid, logCommand); //-------------------------------------------------------- //Only Send Data On Initial Load. if (string.IsNullOrEmpty(sfLead.LeadData.SFLeadID)) { sfLead.ERMSData = await _ermsRepository.GetERMSCustomer(customerGuid, logCommand); } else { sfLead.ERMSData = new ERMSCustomer(); } var response = ServiceHelper.SetGenericServiceResponseForEntity(sfLead); response.Success = true; logCommand.LogMessage = string.Format($"{Service}.{method} completed"); _logHandler.HandleLog(logCommand); return(response); } catch (Exception ex) { AppLogger.LogException(_loggingInstance, ex.Message, ex); return(ServiceHelper.SetErrorGenericServiceResponse(ex)); } }