/// <summary>
        /// This returns a <see cref="CommandWorkflowResult"/> that contains the result of executing a validation action passed into it.
        /// </summary>
        /// <param name="validationFunction">A Func containing the predicate for verifying validity.</param>
        /// <param name="validAction">An Action that contains the validation logic.</param>
        /// <param name="validationError">The error to be thrown in the event of failure.</param>
        /// <param name="existingResult">The existing validation errors, if any.</param>
        /// <returns><see cref="CommandWorkflowResult"/></returns>
        public static CommandWorkflowResult ValidatedAction(
            Func <bool> validationFunction,
            Action validAction,
            string validationError,
            CommandWorkflowResult existingResult = null)
        {
            existingResult = existingResult ?? new CommandWorkflowResult();

            if (validationFunction())
            {
                validAction();
            }
            else
            {
                existingResult.AddError(validationError);
            }

            return(existingResult);
        }
 /// <summary>
 /// Determines whether the specified <see cref="CommandWorkflowResult"/> object is equal to this object.
 /// </summary>
 /// <param name="other">The other <see cref="CommandWorkflowResult"/> object to compare.</param>
 /// <returns>True if they are equal; false if not.</returns>
 protected bool Equals(CommandWorkflowResult other)
 {
     return ValidationResults.SequenceEqual(other.ValidationResults);
 }
 /// <summary>
 /// Determines whether the specified <see cref="CommandWorkflowResult"/> object is equal to this object.
 /// </summary>
 /// <param name="other">The other <see cref="CommandWorkflowResult"/> object to compare.</param>
 /// <returns>True if they are equal; false if not.</returns>
 protected bool Equals(CommandWorkflowResult other)
 {
     return(ValidationResults.SequenceEqual(other.ValidationResults));
 }
        /// <summary>
        /// This returns a <see cref="CommandWorkflowResult"/> that contains the result of executing a validation action passed into it.
        /// </summary>
        /// <param name="validationFunction">A Func containing the predicate for verifying validity.</param>
        /// <param name="validAction">An Action that contains the validation logic.</param>
        /// <param name="validationError">The error to be thrown in the event of failure.</param>
        /// <param name="existingResult">The existing validation errors, if any.</param>
        /// <returns><see cref="CommandWorkflowResult"/></returns>
        public static CommandWorkflowResult ValidatedAction(
            Func<bool> validationFunction,
            Action validAction,
            string validationError,
            CommandWorkflowResult existingResult = null)
        {
            existingResult = existingResult ?? new CommandWorkflowResult();

            if (validationFunction())
            {
                validAction();
            }
            else
            {
                existingResult.AddError(validationError);
            }

            return existingResult;
        }