/// <summary>
        /// Creates a new WCF fault message based on the passed-in information
        /// </summary>
        /// <param name="message">The error message</param>
        /// <param name="type">The error type</param>
        /// <returns>The Fault Exception</returns>
        protected FaultException CreateFault(string type, string message)
        {
            //-- Build the detail element of the Fault Message
            ServiceFaultMessage serviceFaultMessage = new ServiceFaultMessage();

            serviceFaultMessage.Message    = message;
            serviceFaultMessage.StackTrace = String.Empty;
            serviceFaultMessage.Type       = type;

            //Build the Fault Reason
            FaultReason faultReason = new FaultReason(message);

            //Now return the FaultException that contains the details of the exception
            return(new FaultException <ServiceFaultMessage>(serviceFaultMessage, faultReason));
        }
        /// <summary>
        /// Converts a normal exception into one that WCF clients can handle
        /// </summary>
        /// <param name="exception">The normal exception</param>
        /// <returns>The Fault Exception</returns>
        protected FaultException ConvertExceptions(Exception exception)
        {
            //If it's a FaultException already, then we have nothing to do
            if (exception is FaultException)
            {
                return((FaultException)exception);
            }

            //-- Build the detail element of the Fault Message
            ServiceFaultMessage serviceFaultMessage = new ServiceFaultMessage();

            serviceFaultMessage.Message    = exception.Message;
            serviceFaultMessage.StackTrace = exception.StackTrace;
            serviceFaultMessage.Type       = exception.GetType().Name;

            //Build the Fault Reason
            FaultReason faultReason = new FaultReason(exception.Message);

            //Now return the FaultException that contains the details of the exception
            return(new FaultException <ServiceFaultMessage>(serviceFaultMessage, faultReason));
        }