public Swagger.Message GetMessage(Guid threadId, Guid messageId, AdditionalMessageDataOptions additionalMessageDataOptions)
        {
            var c = new Swagger.MessageClient();

            Log?.Invoke($"GetMessage: threadId={threadId}, messageId={messageId}");
            try
            {
                return(c.GetAsync(threadId, messageId).Result);
            }
            catch (AggregateException ae)
            {
                LogExp?.Invoke("GetMessage", ae.InnerException);
                throw ae.InnerException;
            }
        }
        public Guid?AddMessage(Guid threadId, Guid?parentId, string messageText)
        {
            var c = new Swagger.MessageClient();
            var m = new Swagger.Message();

            m.ContentKey = threadId;
            if (threadId != parentId)
            {
                m.ReplyToMessageKey = parentId;
            }
            m.Text = messageText;
            try
            {
                var res = c.CreateAsyncAsync(m).Result;
                return(res.Id);
            }
            catch (AggregateException ae)
            {
                LogExp?.Invoke("GetMessageListByThreadId", ae.InnerException);
                throw ae;
            }
        }
        public Swagger.PagedResultOfIResource GetMessageListByThreadId(Guid threadId, MessageSortOrder?sortOrder, SortDirection?sortDir, int startRow, int maxRows, AdditionalMessageDataOptions additionalMessageDataOptions)
        {
            var c = new Swagger.MessageClient();

            try
            {
                Log?.Invoke($"GetMessageListByThreadId: threadId={threadId}");
                var res = c.GetListAsync(threadId, null, startRow - 1, maxRows, null, Swagger.Direction._0).Result;
                return(res);
            }
            catch (AggregateException ae)
            {
                LogExp?.Invoke($"AEXP: GetMessageListByThreadId: threadId={threadId}", ae.InnerException);
            }
            catch (Exception exp)
            {
                LogExp?.Invoke($"EXP: GetMessageListByThreadId: threadId={threadId}", exp);
            }

            var res3 = new Swagger.PagedResultOfIResource();

            return(res3);
        }