/// <summary>
        /// Logs an exception to the exception log file. Useful when failure to log to database.
        /// </summary>
        protected void LogExceptionToFile(TechnolutionExceptionStack exceptionStack)
        {
            try
              {
            if (exceptionStack == null)
              return;

            // Make sure we have correct stack.
            exceptionStack = exceptionStack.GetStackToThrow();
            // Log to file.
            StringBuilder sb = new StringBuilder();
            sb.Append(exceptionStack.ToString());
            sb.AppendLine();
            sb.AppendLine();

            SaveToLogFile(sb.ToString());
              }
              catch
              { // What do we do now? Ignore exception as we tried logging to the file system and failed.
              }
        }
        /// <summary>
        /// Fires a critical event for notification of actions.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="technolutionException">The exception to notify users about.</param>
        public static void FireExceptionEvent(object sender, TechnolutionExceptionStack technolutionException)
        {
            EventNotification notification = new EventNotification(EventLevel.Critical, false);
              notification.Messages.Add(new EventMessage("Exception Occurred: {0}", technolutionException.ToString()));

              if (ExceptionEvent != null)
            ExceptionEvent.Invoke(technolutionException);

              FireEvent(sender, notification, true);
        }