private void SaveInnerExceptionsToDatabase(SqlTransaction transaction, Exception parentException,
                                                   int eventId, int parentExceptionId)
        {
            foreach (var innerException in LoggingHelper.GetInnerExceptions(parentException))
            {
                int exceptionId =
                    this.SaveExceptionToDatabase(transaction, innerException, eventId, parentExceptionId);

                this.SaveInnerExceptionsToDatabase(transaction, innerException, eventId, exceptionId);
            }
        }
        private static void WriteInnerExceptionsRecursive(XmlWriter writer, Exception parentException)
        {
            var innerExceptions = LoggingHelper.GetInnerExceptions(parentException);

            if (innerExceptions.Length > 0)
            {
                writer.WriteStartElement("InnerExceptions");

                foreach (var innerException in innerExceptions)
                {
                    WriteExceptionRecursive(writer, "InnerException", innerException);
                }

                writer.WriteEndElement();
            }
        }