public async Task <ActionResult> Index(int?id) { if (id != null) { Recording recording = await recordingsDb.Recordings.FindAsync(id); if (recording == null) { return(HttpNotFound()); } Session[helper.RecordingKey] = id; } IEnumerable <Event> selectedEvents = Enumerable.Empty <Event>(); IEnumerable <Contact> selectedContacts = Enumerable.Empty <Contact>(); IEnumerable <Lead> selectedLeads = Enumerable.Empty <Lead>(); string eventsQuery = "SELECT Id, WhoId, OwnerId, Description, Location, Subject, IsAllDayEvent, ActivityDateTime, ActivityDate, DurationInMinutes, StartDateTime, EndDateTime, CreatedDate From Event"; string contactsQuery = "SELECT Id, Name From Contact"; string leadsQuery = "SELECT Id, Name From Lead"; string operationName = "Query all Salesforce Events, Contacts, and Leads."; try { selectedEvents = await helper.SalesforceRequest <Event>(eventsQuery); selectedContacts = await helper.SalesforceRequest <Contact>(contactsQuery); selectedLeads = await helper.SalesforceRequest <Lead>(leadsQuery); } catch (Exception ex) { helper.CatchSalesforceRequest(this, ex, operationName); } if (helper.LoginRedirectNeeded(this)) { return(helper.RedirectToLogin(this)); } RecordingTargetSelection recordingTargets = new RecordingTargetSelection(selectedEvents, selectedContacts, selectedLeads); return(View(recordingTargets)); }