public void SendNotifacations() { IReadOnlyCollection <EmailNotification> messages = _provider.GetUnSentNotifications <EmailNotification>(); using (var smsLog = new StreamWriter("email.log", true)) { foreach (var m in messages) { m.IsSent = true; smsLog.WriteLine($"To: {m.PersonId}, Phone: {m.Email}, Text : {m.Message}"); } } _provider.MarkNotificationsAsSent(messages); }