// use funcBeforeSend to populate message. protected virtual bool SendMessage(Action <IMessage> funcBeforeSend) { Guard.ThrowIfNull("funcBeforeSend", funcBeforeSend); if (_peer == null) { return(false); } var host = ServiceContainer.GetService <IHostApplication>(); if (host == null) { return(false); } var msg = host.CreateMessage(); if (msg != null) { funcBeforeSend(msg); var result = _peer.Notify(msg); return(TResult.Succeeded(result)); } return(false); }