static string ProtoMessageToString(ProtoMessage msg)
        {
            if (!msg.HasPayload)
            {
                return("ERROR in ProtoMessage: Corrupted execution event, no payload found");
            }
            var _str = "ProtoMessage{";

            switch ((ProtoPayloadType)msg.PayloadType)
            {
            case ProtoPayloadType.PROTO_MESSAGE:
                var _msg = ProtoMessage.CreateBuilder().MergeFrom(msg.Payload).Build();
                _str += ProtoMessageToString(_msg);
                break;

            case ProtoPayloadType.HEARTBEAT_EVENT:
                var _hb = ProtoHeartbeatEvent.CreateBuilder().MergeFrom(msg.Payload).Build();
                _str += "Heartbeat";
                break;

            case ProtoPayloadType.ERROR_RES:
                var _err = ProtoErrorRes.CreateBuilder().MergeFrom(msg.Payload).Build();
                _str += "ErrorResponse{errorCode:" + _err.ErrorCode + (_err.HasDescription ? ", description:" + _err.Description : "") + "}";
                break;

            default:
                _str += OpenApiMessageToString(msg);
                break;
            }

            _str += (msg.HasClientMsgId ? ", clientMsgId:" + msg.ClientMsgId : "") + "}";

            return(_str);
        }
        static string ProtoMessageToString(ProtoMessage msg)
        {
            if (!msg.HasPayload)
            {
                return("ERROR in ProtoMessage: Corrupted execution event, no payload found");
            }
            var _str = "ProtoMessage{";

            switch ((ProtoPayloadType)msg.PayloadType)
            {
            //case ProtoPayloadType.PROTO_MESSAGE: // FIXME - was this working?
            //    var _msg = ProtoMessage.CreateBuilder().MergeFrom(msg.Payload).Build();
            //    _str += ProtoMessageToString(_msg);
            //    break;
            case ProtoPayloadType.PING_REQ:
                var _ping_req = ProtoPingReq.CreateBuilder().MergeFrom(msg.Payload).Build();
                _str += "PingRequest{timestamp:" + _ping_req.Timestamp.ToString() + "}";
                break;

            case ProtoPayloadType.PING_RES:
                var _ping_res = ProtoPingRes.CreateBuilder().MergeFrom(msg.Payload).Build();
                _str += "PingResponse{timestamp:" + _ping_res.Timestamp + "}";
                break;

            case ProtoPayloadType.HEARTBEAT_EVENT:
                var _hb = ProtoHeartbeatEvent.CreateBuilder().MergeFrom(msg.Payload).Build();
                _str += "Heartbeat";
                break;

            case ProtoPayloadType.ERROR_RES:
                var _err = ProtoErrorRes.CreateBuilder().MergeFrom(msg.Payload).Build();
                _str += "ErrorResponse{errorCode:" + _err.ErrorCode + (_err.HasDescription ? ", description:" + _err.Description : "") + "}";
                break;

            default:
                _str += OpenApiMessageToString(msg);
                break;
            }
            _str += (msg.HasClientMsgId ? ", clientMsgId:" + msg.ClientMsgId : "")
                    //+ (msg.HasPayloadString ? ", payloadString:" + msg.PayloadString : "")  // FIXME - was this working?
                    + "}";

            return(_str);
        }
 //public ProtoOAPingReq GetPingRequest(byte[] msg = null)
 //{
 //    return ProtoOAPingReq.CreateBuilder().MergeFrom(GetPayload(msg)).Build();
 //}
 //public ProtoOAPingRes GetPingResponse(byte[] msg = null)
 //{
 //    return ProtoOAPingRes.CreateBuilder().MergeFrom(GetPayload(msg)).Build();
 //}
 public ProtoHeartbeatEvent GetHeartbeatEvent(byte[] msg = null)
 {
     return(ProtoHeartbeatEvent.CreateBuilder().MergeFrom(GetPayload(msg)).Build());
 }
 public ProtoMessage CreateHeartbeatEvent(string clientMsgId = null)
 {
     return(CreateMessage((uint)ProtoPayloadType.HEARTBEAT_EVENT, ProtoHeartbeatEvent.CreateBuilder().Build().ToByteString(), clientMsgId));
 }