public override T Execute <T>(ICommand <T> command) { var processApplicationIdentifier = ProcessApplicationContextImpl.Get(); if (processApplicationIdentifier != null) { // clear the identifier so this interceptor does not apply to nested commands ProcessApplicationContextImpl.Clear(); try { var reference = GetPaReference(processApplicationIdentifier); var cmdObj = command as ICommand <object>; return((T)Context.ExecuteWithinProcessApplication <object>(() => { return Next.Execute(cmdObj); }, reference)); } finally { // restore the identifier for subsequent commands ProcessApplicationContextImpl.Set(processApplicationIdentifier); } } return(Next.Execute(command)); }