void writeResponse(NamedPipeServerStream pipe, object response)
        {
            // Get response and write.
            var writer = new JsonStreamWriter(pipe, Encoding.UTF8,
                                              new IsoDateTimeConverter());

            writer.WriteJson(response);
            writer.Flush();
        }
        void HandleClientConnection(NamedPipeServerStream pipe)
        {
            // Read query request.
            var reader  = new JsonStreamReader(pipe, Encoding.UTF8);
            var request = reader.ReadJson <Request>();

            // Get response and write.
            var response = HandleRequest(request);
            var writer   = new JsonStreamWriter(pipe, Encoding.UTF8,
                                                new IsoDateTimeConverter());

            writer.WriteJson(response);
            writer.Flush();
        }