public void Close()
        {
            lock (this.@lock)
            {
                if (!this.IsOpen)
                {
                    return;
                }

                this.Manifest = null;

                this.Path   = string.Empty;
                this.IsOpen = false;

                try
                {
                    var stream = this.Client.GetStream();
                    this.SendMessage(stream, "{\"command\":\"close\"}");

                    var responseJson = JObject.Parse(this.ReceiveMessage(stream));
                    if (responseJson.ContainsKey("error"))
                    {
                        throw new InvalidDataException(responseJson["error"].ToString());
                    }
                }
                catch
                {
                }
            }
        }
        public void FetchManifest()
        {
            lock (this.@lock)
            {
                if (!this.IsOpen)
                {
                    return;
                }

                var stream = this.Client.GetStream();
                this.SendMessage(stream, "{\"command\":\"manifest\"}");

                var response = this.ReceiveMessage(stream);
                var json     = JObject.Parse(response);
                if (json.ContainsKey("error"))
                {
                    throw new InvalidDataException("Cannot fetch database manifest.");
                }

                this.Manifest = new DatabaseManifest(json["manifest"].Value <JObject>());
            }
        }