private static IObservable <TraceEvent[]> SaveServerTraceMessages(this XafApplication application)
 {
     return(application.BufferUntilCompatibilityChecked(TraceEventReceiver.TraceEvent)
            .Buffer(TimeSpan.FromSeconds(2)).WhenNotEmpty()
            .TakeUntil(application.WhenDisposed())
            .Select(list => {
         return application.ObjectSpaceProvider.ToObjectSpace()
         .SelectMany(space => space.SaveTraceEvent(list)).ToEnumerable().ToArray();
     }));
 }