public static List <ConversationHistoryModel> FindAllByDeviceId(string _deviceId, ConversationStatus _status)
        {
            var dc        = new ConversationHistoriesDataContext(SqlConnectionString);
            var histories =
                from n in dc.ConversationHistories
                where n.DeviceId == _deviceId
                where n.Status == _status.ObtainStatus()
                select n;

            return(Build(histories));
        }
        public static ApiResult AddMessageText(string _deviceId, string _fromUserId, string _fromMessage, string _toMessage, string _intent, double _score, long _synAppsAccountId, string _synAppsAccountName, long _assetId, ConversationStatus _status)
        {
            var apiResult = new ApiResult()
            {
                StatusCode = StatusCode.Success
            };
            var now = DateTime.UtcNow;
            var dc  = new ConversationHistoriesDataContext(SqlConnectionString);
            var conversationHistory = new ConversationHistory
            {
                DeviceId           = _deviceId,
                FromUserId         = _fromUserId,
                FromMessage        = _fromMessage,
                ToMessage          = _toMessage,
                Intent             = _intent,
                Score              = _score,
                SynAppsAccountId   = _synAppsAccountId,
                SynAppsAccountName = _synAppsAccountName,
                SynAppAssetId      = _assetId,
                Status             = _status.ObtainStatus(),
                UpdatedAt          = now,
                CreatedAt          = now
            };

            try
            {
                dc.ConversationHistories.InsertOnSubmit(conversationHistory);
                dc.SubmitChanges();
            }
            catch (Exception e)
            {
                apiResult.StatusCode = StatusCode.Error;
                apiResult.Message    = e.Message;
            }

            return(apiResult);
        }