/// <summary>
        /// Add error record and log message
        /// </summary>
        /// <param name="result"></param>
        /// <param name="logger"></param>
        /// <param name="errorKey">Error key found in culture files</param>
        /// <param name="errorMessage">Translated error message</param>
        /// <param name="logMessage">Log message - commonly un-translated version of errorMessage</param>
        /// <param name="resourceIdentifier"></param>
        /// <param name="errors">Additional errors to forward. These are assumed to have already been translated.</param>
        /// <param name="methodName">Name of calling method for use in log message for improved debugging</param>
        public static void AddErrorsAndLog <T>(this IResult <T> result, ILogger logger, string errorKey, string errorMessage, string logMessage, string resourceIdentifier, IEnumerable <IError> errors = null, string methodName = null)
        {
            if (string.IsNullOrWhiteSpace(errorMessage))
            {
                errorMessage = "";
            }

            // Add singular error
            if (!string.IsNullOrWhiteSpace(errorKey))
            {
                result.AddError(errorKey, errorMessage);
            }

            // Add error list
            if (errors != null && errors.Any())
            {
                result.AddErrors(errors);
            }

            var identifierText = !string.IsNullOrWhiteSpace(resourceIdentifier) ? $" ({resourceIdentifier}) -" : "";

            // If not provided, try to detect method name
            if (string.IsNullOrWhiteSpace(methodName))
            {
                methodName = new StackTrace().GetFrame(1).GetMethod().Name;
            }

            // Log all of the above
            logger.LogError($"[{methodName}]{identifierText} {logMessage}");
        }
 /// <summary>
 /// Convenience method to simplify common scenario of bubbling errors and
 /// returning null (or default for T type) to the parent
 /// </summary>
 /// <param name="destination"></param>
 /// <param name="source"></param>
 /// <typeparam name="T"></typeparam>
 /// <typeparam name="TSource"></typeparam>
 /// <returns></returns>
 public static T AddErrorsAndReturnDefault <T, TSource>(this IResult <T> destination, IResult <TSource> source)
 {
     destination.AddErrors(source?.Errors);
     return(default(T));
 }
 public static List <IError> AddErrors <T, TSource>(this IResult <T> destination, IResult <TSource> source)
 {
     destination.AddErrors(source?.Errors);
     return(destination.Errors);
 }