public async System.Threading.Tasks.Task CheckForMessages(ArrivalsModel model) { ISmsProcessor sms = GetSmsProcessor(); // sms.Initialize(); // TODO: Thread this into the background, but report errors back to the status screen // TODO: If this needs paging or something, repeat this call till its complete, or similar var messages = sms.ReceiveMessages(); foreach (var item in messages) { var appts = MatchPatient(model, item.phone); foreach (var appt in appts) { if (ActionForMessage(item.message) == "arrived") { await ArriveAppointment(appt); appt.LastPatientMessage = item.message; } } } }