private static StashResponse <T> ParseErrorResponse(string jsonString)
        {
            var json = new JObject();

            try
            {
                System.Console.WriteLine(jsonString);
                json = (JObject)JsonConvert.DeserializeObject(jsonString);
            }
            catch (JsonReaderException)
            {
                MessageBox.Show(jsonString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                var errorResponse = new StashResponse <T> {
                    Success = false
                };
                return(errorResponse);
            }
            if (json["errors"] != null)
            {
                var messages      = new List <string>();
                var errorResponse = new StashResponse <T> {
                    Success = false
                };
                foreach (var error in json["errors"])
                {
                    var sb = new StringBuilder();
                    sb.AppendLine(error["message"].ToString());
                    if (error["reviewerErrors"] != null)
                    {
                        sb.AppendLine();
                        foreach (var reviewerError in error["reviewerErrors"])
                        {
                            sb.Append(reviewerError["message"]).AppendLine();
                        }
                    }
                    messages.Add(sb.ToString());
                }

                errorResponse.Messages = messages;
                return(errorResponse);
            }
            if (json["message"] != null)
            {
                return(new StashResponse <T> {
                    Success = false, Messages = new[] { json["message"].ToString() }
                });
            }
            return(new StashResponse <T> {
                Success = false, Messages = new[] { "Unknown error." }
            });
        }
        private static StashResponse <T> ParseErrorResponse(string jsonString)
        {
            var json = (JObject)JsonConvert.DeserializeObject(jsonString);

            if (json["errors"] != null)
            {
                var messages      = new List <string>();
                var errorResponse = new StashResponse <T> {
                    Success = false
                };
                foreach (var error in json["errors"])
                {
                    var sb = new StringBuilder();
                    sb.AppendLine(error["message"].ToString());
                    if (error["reviewerErrors"] != null)
                    {
                        sb.AppendLine();
                        foreach (var reviewerError in error["reviewerErrors"])
                        {
                            sb.Append(reviewerError["message"]).AppendLine();
                        }
                    }
                    messages.Add(sb.ToString());
                }

                errorResponse.Messages = messages;
                return(errorResponse);
            }
            if (json["message"] != null)
            {
                return(new StashResponse <T> {
                    Success = false, Messages = new[] { json["message"].ToString() }
                });
            }
            return(new StashResponse <T> {
                Success = false, Messages = new[] { "Unknown error." }
            });
        }