private Envelope[] filterExpired(IDocumentSession session, IEnumerable <Envelope> outgoing) { var expiredMessages = outgoing.Where(x => x.IsExpired()).ToArray(); _logger.DiscardedExpired(expiredMessages); session.DeleteEnvelopes(_marker.Outgoing, expiredMessages); return(outgoing.Where(x => !x.IsExpired()).ToArray()); }