public async Task <ItemResponse> RequestAsync(ItemRequest request)
        {
            try
            {
                var writer = new JsonStreamWriter(client, Encoding);
                await writer.WriteJsonAsync(request);

                await writer.FlushAsync();

                client.WaitForPipeDrain();

                var reader   = new JsonStreamReader(client, Encoding);
                var response = await reader.ReadJsonAsync <ItemResponse>();

                return(response);
            }
            catch (EndOfStreamException)
            {
                return(null);
            }
            catch (JsonException)
            {
                return(null);
            }
        }
        /// <summary>
        /// Make an item request to the interface server.
        /// </summary>
        /// <param name="request">Item request to make.</param>
        /// <returns></returns>
        public ItemResponse Request(ItemRequest request)
        {
            try
            {
                var writer = new JsonStreamWriter(client, Encoding);
                writer.WriteJson(request);
                writer.Flush();

                client.WaitForPipeDrain();

                var reader   = new JsonStreamReader(client, Encoding);
                var response = reader.ReadJson <ItemResponse>();

                return(response);
            }
            catch (EndOfStreamException)
            {
                return(null);
            }
            catch (JsonException)
            {
                return(null);
            }
        }
        /// <summary>
        /// Make an item request to the interface server.
        /// </summary>
        /// <param name="request">Item request to make.</param>
        /// <returns></returns>
        public ItemResponse Request(ItemRequest request)
        {
            try
            {
                var writer = new JsonStreamWriter(client, Encoding);
                writer.WriteJson(request);
                writer.Flush();

                client.WaitForPipeDrain();

                var reader = new JsonStreamReader(client, Encoding);
                var response = reader.ReadJson<ItemResponse>();

                return response;
            }
            catch (EndOfStreamException)
            {
                return null;
            }
            catch (JsonException)
            {
                return null;
            }
        }
        public async Task<ItemResponse> RequestAsync(ItemRequest request)
        {
            try
            {
                var writer = new JsonStreamWriter(client, Encoding);
                await writer.WriteJsonAsync(request);
                await writer.FlushAsync();

                client.WaitForPipeDrain();

                var reader = new JsonStreamReader(client, Encoding);
                var response = await reader.ReadJsonAsync<ItemResponse>();

                return response;
            }
            catch (EndOfStreamException)
            {
                return null;
            }
            catch (JsonException)
            {
                return null;
            }
        }