/// <summary>
        /// Adds the message to the collection.
        /// </summary>
        /// <param name="severity">The severity of this new message.</param>
        /// <param name="message">The body text for this new message.</param>
        /// <param name="errorCode">An optional error code to apply to the message..</param>
        /// <param name="origin">The origin in the source text, if any, that this message relates to.</param>
        /// <param name="exceptionThrown">An exception that may have been thrown and caused this message to be created.</param>
        /// <returns>IGraphExecutionMessage.</returns>
        public IGraphMessage Add(
            GraphMessageSeverity severity,
            string message,
            string errorCode          = "",
            SourceOrigin origin       = null,
            Exception exceptionThrown = null)
        {
            var graphMessage = new GraphExecutionMessage(
                severity,
                message,
                errorCode,
                origin,
                exceptionThrown);

            return(this.Add(graphMessage));
        }
        /// <summary>
        /// Creates a graph message from the given rule and message specifics in a common manner.
        /// </summary>
        /// <param name="validationRule">The validation rule that is being broken.</param>
        /// <param name="messageText">The context sensitive message text.</param>
        /// <param name="messageOrigin">The origin location where this message is generated, if any.</param>
        /// <param name="exception">The exception generated with extended details, if any.</param>
        /// <returns>IGraphMessage.</returns>
        internal static IGraphMessage FromValidationRule(
            IValidationRule validationRule,
            string messageText,
            SourceOrigin messageOrigin = null,
            Exception exception        = null)
        {
            var graphMessage = new GraphExecutionMessage(
                GraphMessageSeverity.Critical,
                messageText,
                validationRule.ErrorCode,
                messageOrigin,
                exception);

            graphMessage.MetaData.Add(Constants.Messaging.REFERENCE_RULE_NUMBER, validationRule.RuleNumber);
            graphMessage.MetaData.Add(Constants.Messaging.REFERENCE_RULE_URL, validationRule.ReferenceUrl);
            return(graphMessage);
        }