/// <summary>
 /// Send audit merge
 /// </summary>
 protected virtual void SendAuditMerge(OutcomeIndicator outcome, IMessage message, RecordMergeResult recordMergeResult)
 {
     if (recordMergeResult != null)
     {
         AuditUtil.AuditDelete(outcome, "ADT^A40", new Patient()
         {
             Key = recordMergeResult.Replaced.First()
         });
         AuditUtil.AuditUpdate(outcome, "ADT^A40", new Patient()
         {
             Key = recordMergeResult.Survivors.First()
         });
     }
     else
     {
         AuditUtil.AuditUpdate <IdentifiedData>(outcome, "ADT^A40");
     }
 }
        public virtual Object Obsolete(object key)
        {
            if ((this.Capabilities & ResourceCapabilityType.Delete) == 0)
            {
                throw new NotSupportedException(this.m_localizationService.GetString("error.type.NotSupportedException"));
            }

            try
            {
                var retVal = this.GetRepository().Obsolete((Guid)key);
                AuditUtil.AuditDelete(Core.Auditing.OutcomeIndicator.Success, key.ToString(), retVal);
                return(retVal);
            }
            catch (Exception e)
            {
                AuditUtil.AuditDelete <TResource>(Core.Auditing.OutcomeIndicator.MinorFail, key.ToString());
                this.m_tracer.TraceError($"Error obsoleting resource {key}");
                throw new Exception(this.m_localizationService.FormatString("error.rest.common.obsoletingResource", new { param = nameof(key) }), e);
            }
        }