/// <exception cref="System.IO.IOException"/>
        private void AddOrUpdateDelegationKey(DelegationKey key, bool isUpdate)
        {
            string nodeCreatePath = GetNodePath(ZkDtsmMasterKeyRoot, DelegationKeyPrefix + key
                                                .GetKeyId());
            ByteArrayOutputStream os    = new ByteArrayOutputStream();
            DataOutputStream      fsOut = new DataOutputStream(os);

            if (Log.IsDebugEnabled())
            {
                Log.Debug("Storing ZKDTSMDelegationKey_" + key.GetKeyId());
            }
            key.Write(fsOut);
            try
            {
                if (zkClient.CheckExists().ForPath(nodeCreatePath) != null)
                {
                    zkClient.SetData().ForPath(nodeCreatePath, os.ToByteArray()).SetVersion(-1);
                    if (!isUpdate)
                    {
                        Log.Debug("Key with path [" + nodeCreatePath + "] already exists.. Updating !!");
                    }
                }
                else
                {
                    zkClient.Create().WithMode(CreateMode.Persistent).ForPath(nodeCreatePath, os.ToByteArray
                                                                                  ());
                    if (isUpdate)
                    {
                        Log.Debug("Updating non existent Key path [" + nodeCreatePath + "].. Adding new !!"
                                  );
                    }
                }
            }
            catch (KeeperException.NodeExistsException)
            {
                Log.Debug(nodeCreatePath + " znode already exists !!");
            }
            catch (Exception ex)
            {
                throw new IOException(ex);
            }
            finally
            {
                os.Close();
            }
        }
 /// <summary>Update the data for a path</summary>
 /// <param name="path">path of operation</param>
 /// <param name="data">new data</param>
 /// <exception cref="System.IO.IOException"/>
 public virtual void ZkUpdate(string path, byte[] data)
 {
     Preconditions.CheckArgument(data != null, "null data");
     CheckServiceLive();
     path = CreateFullPath(path);
     try
     {
         if (Log.IsDebugEnabled())
         {
             Log.Debug("Updating {} with {} bytes", path, data.Length);
         }
         curator.SetData().ForPath(path, data);
     }
     catch (Exception e)
     {
         throw OperationFailure(path, "update()", e);
     }
 }