/// <summary>
        /// To the service exception.
        /// </summary>
        /// <returns>BaseServiceException.</returns>
        public BaseServiceException ToServiceException()
        {
            BaseServiceException result = null;

            switch (this.ErrorCode)
            {
            case FaultCode.ThreadAbortMessage:
            case FaultCode.OperationFailureException:
            case FaultCode.InitializationFailureException:
                result = new ServiceErrorException();
                break;

            case FaultCode.InvalidFormatOrValue:
            case FaultCode.NullObjectOrParameter:
                result = new InvalidObjectServiceException();
                break;

            case FaultCode.ResourceNotFound:
                result = new ResourceNotFoundServiceException();
                break;

            case FaultCode.UnauthorizedOperation:
                result = new UnauthorizedOperationServiceException();
                break;

            case FaultCode.DataConflictException:
                result = new DataConflictServiceException();
                break;

            case FaultCode.Unknown:
            default:
                result = new UnknownServiceException();
                break;
            }

            return(result);
        }
        /// <summary>
        /// To the service exception.
        /// </summary>
        /// <returns>BaseServiceException.</returns>
        public BaseServiceException ToServiceException()
        {
            BaseServiceException result = null;

            switch (this.ErrorCode)
            {
                case FaultCode.ThreadAbortMessage:
                case FaultCode.OperationFailureException:
                case FaultCode.InitializationFailureException:
                    result = new ServiceErrorException();
                    break;
                case FaultCode.InvalidFormatOrValue:
                case FaultCode.NullObjectOrParameter:
                    result = new InvalidObjectServiceException();
                    break;
                case FaultCode.ResourceNotFound:
                    result = new ResourceNotFoundServiceException();
                    break;
                case FaultCode.UnauthorizedOperation:
                    result = new UnauthorizedOperationServiceException();
                    break;
                case FaultCode.DataConflictException:
                    result = new DataConflictServiceException();
                    break;
                case FaultCode.Unknown:
                default:
                    result = new UnknownServiceException();
                    break;

            }

            return result;
        }