/// <inheritdoc/>
        public async Task <(DidExchangeProblemReportMessage, ConnectionRecord)> AbandonDidExchange(IAgentContext agentContext, ConnectionRecord connectionRecord)
        {
            await connectionRecord.TriggerAsync(ConnectionTrigger.Abandon);

            await _recordService.UpdateAsync(agentContext.Wallet, connectionRecord);

            var myRole      = connectionRecord.Role;
            var problemCode = myRole == ConnectionRole.Invitee
                ? DidExchangeProblemReportMessage.Error.ResponseNotAccepted
                : DidExchangeProblemReportMessage.Error.RequestNotAccepted;

            var problemReport = new DidExchangeProblemReportMessage {
                ProblemCode = problemCode
            };

            return(problemReport, connectionRecord);
        }
        /// <inheritdoc/>
        public async Task <ConnectionRecord> ProcessProblemReportMessage(IAgentContext agentContext, DidExchangeProblemReportMessage problemReportMessage, ConnectionRecord connectionRecord)
        {
            await connectionRecord.TriggerAsync(ConnectionTrigger.Abandon);

            await _recordService.UpdateAsync(agentContext.Wallet, connectionRecord);

            _eventAggregator.Publish(new ServiceMessageProcessingEvent
            {
                MessageType = problemReportMessage.Type,
                RecordId    = connectionRecord.Id,
                ThreadId    = problemReportMessage.GetThreadId()
            });

            return(connectionRecord);
        }