public ExceptionWorkItemJson(ExceptionEntity exception, IApplicationInfo applicationInfo)
        {
            Json = new JsonPatchDocument();
            Add("System.Title", TFSStringUtil.GenerateValidTFSStringType(exception.ExceptionTitle));
            Add(CommentFieldName, exception.Username + ":\n" + exception.Comment);
            Add("System.AreaPath", applicationInfo.Area);
            Add(Application, exception.ApplicationName);
            Add(AssignedToFieldName, applicationInfo.AssignedTo);
            Add(ExceptionReporterFieldName, exception.Reporter);
            Add(BuildVersionFieldName, exception.Version);
            Add(RefCountFieldName, 1.ToString());

            //if (wi.Fields.Contains(ExceptionMessageExFieldName))
            Add(ExceptionMessageFieldName, exception.ExceptionMessage);

            Add(ExceptionMessageFieldName, TFSStringUtil.GenerateValidTFSStringType(exception.ExceptionMessage));
            Add(ExceptionTypeFieldName, exception.ExceptionType);

            var kmParams = exception.ExceptionClass.Split('|');

            Add(ClassFieldName, kmParams[0]);

            //if (wi.Fields.Contains(AssemblyName) && kmParams.Count() > 1)
            //{
            Add(AssemblyName, kmParams[1]);
            Add(MethodFieldName, exception.ExceptionMethod);
            Add(SourceFieldName, exception.ExceptionSource);
            Add(StackTraceFieldName, exception.StackTrace);
            Add(StackChecksumFieldName, Crc32.GetStreamCrc32(exception.StackTrace).ToString());
        }
        private static string GetTitle(System.Exception ex)
        {
            var innerEx       = ExceptionRegistrator.GetMostInnerException(ex);
            var splittedTitle = innerEx.StackTrace.Split(
                new[] { " in " }, StringSplitOptions.RemoveEmptyEntries).First().Trim().Split(
                new[] { " at " }, StringSplitOptions.RemoveEmptyEntries);

            var title = GetFirstLine(splittedTitle).Trim().Split(
                new[] { "(" }, StringSplitOptions.RemoveEmptyEntries).First().Trim();

            title = innerEx.Message.Trim('.') + (title.Trim().StartsWith("at") ? " " : " at ") + title.Trim();
            title = TFSStringUtil.GenerateValidTFSStringType(title);
            return(title);
        }