public async Task <ILead> SaveAsync(ILead lead) { var currentLead = RetrieveCurrentLead(lead.Id); if (currentLead != null) { // Sync-up server-side maintained state props ((ILeadState)lead) .SetSuccessfulPlacementCheck(currentLead.SuccessfulPlacementCheck) .SetSuccessfulLeadSubmission((currentLead.SuccessfulLeadSubmission)) .SetIpAddress(currentLead.IpAddress); } var id = await UpsertLeadAsync(lead).ConfigureAwait(false); // Set the Id on this lead and then store it in local cache StoreLeadInLocalCache(lead.SetId(id)); return(lead); }