/// <summary>
        /// Handles the GetTreeResources message from a customer.
        /// </summary>
        /// <param name="header">The message header.</param>
        /// <param name="getTreeResources">The GetTreeResources message.</param>
        protected virtual void HandleGetTreeResources(IMessageHeader header, GetTreeResources getTreeResources)
        {
            var args = Notify(OnGetTreeResources, header, getTreeResources, new List <Resource>());

            HandleGetTreeResources(args);

            if (!args.Cancel)
            {
                GetResourcesResponse(header, args.Context);
            }
        }
        /// <summary>
        /// Sends a GetTreeResources message to a store.
        /// </summary>
        /// <param name="contextInfo">The context information.</param>
        /// <returns>The message identifier.</returns>
        public virtual long GetTreeResources(ContextInfo contextInfo)
        {
            var header = CreateMessageHeader(Protocols.Discovery, MessageTypes.Discovery.GetTreeResources);

            var getResources = new GetTreeResources
            {
                Context = contextInfo
            };

            return(Session.SendMessage(header, getResources,
                                       h => _requests[h.MessageId] = contextInfo.Uri // Cache requested URIs by message ID
                                       ));
        }