/// <summary>
        /// Registers a delegate action to be invoked before this shell scope will be disposed.
        /// </summary>
        public static ShellScope RegisterBeforeDispose(this ShellScope scope, Action <ShellScope> callback)
        {
            scope?.BeforeDispose(scope =>
            {
                callback(scope);
                return(Task.CompletedTask);
            });

            return(scope);
        }
 /// <summary>
 /// Registers a delegate task to be invoked before this shell scope will be disposed.
 /// </summary>
 public static ShellScope RegisterBeforeDispose(this ShellScope scope, Func <ShellScope, Task> callback)
 {
     scope?.BeforeDispose(callback);
     return(scope);
 }