private void RegisterWatcher(RequestDefinitions.IRingMasterRequest request, Func <string, IWatcher, IWatcher> registerWatcher)
        {
            switch (request.RequestType)
            {
            case RingMasterRequestType.Exists:
                RequestDefinitions.RequestExists existsRequest = (RequestDefinitions.RequestExists)request;
                if (existsRequest.Watcher != null)
                {
                    existsRequest.Watcher = registerWatcher(existsRequest.Path, existsRequest.Watcher);
                }

                break;

            case RingMasterRequestType.GetData:
                RequestDefinitions.RequestGetData getDataRequest = (RequestDefinitions.RequestGetData)request;
                if (getDataRequest.Watcher != null)
                {
                    getDataRequest.Watcher = registerWatcher(getDataRequest.Path, getDataRequest.Watcher);
                }

                break;

            case RingMasterRequestType.GetChildren:
                RequestDefinitions.RequestGetChildren getChildrenRequest = (RequestDefinitions.RequestGetChildren)request;
                if (getChildrenRequest.Watcher != null)
                {
                    getChildrenRequest.Watcher = registerWatcher(getChildrenRequest.Path, getChildrenRequest.Watcher);
                }

                break;
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RequestGetChildren"/> class.
 /// </summary>
 /// <param name="request">Request to wrap</param>
 /// <param name="context">Context associated with the request</param>
 /// <param name="callback">Callback to invoke when the request is completed</param>
 public RequestGetChildren(RequestDefinitions.RequestGetChildren request, object context, Children2CallbackDelegate callback)
     : base(request, context)
 {
     this.callback = callback;
 }