public static ServiceResult <TargetContentType> CopyButSucceededWithContent <SourceContentType, TargetContentType>(this IServiceResult <SourceContentType> result, TargetContentType content)
        {
            var copiedResult = result.copy <SourceContentType, TargetContentType>();
            IMutableServiceResult mutableServiceResult = copiedResult;

            mutableServiceResult.Succeeded = true;
            mutableServiceResult.Content   = content;
            return(copiedResult);
        }
        public static ServiceResult <TargetContentType> CopyButFailedIfFailed <SourceContentType, TargetContentType>(this IServiceResult <SourceContentType> result, JsonErrors?errors = null)
        {
            result = result ?? throw new ArgumentNullException(nameof(result));

            if (!result.Succeeded)
            {
                return(result.CopyButFailed <SourceContentType, TargetContentType>(errors));
            }

            return(result.copy <SourceContentType, TargetContentType>());
        }
        public static ServiceResult <TargetContentType> CopyButSucceededWithContentIfSucceeded <SourceContentType, TargetContentType>(this IServiceResult <SourceContentType> result, TargetContentType content)
        {
            result = result ?? throw new ArgumentNullException(nameof(result));

            if (result.Succeeded)
            {
                return(result.CopyButSucceededWithContent(content));
            }

            return(result.copy <SourceContentType, TargetContentType>());
        }
        public static ServiceResult <TargetContentType> CopyButFailed <SourceContentType, TargetContentType>(this IServiceResult <SourceContentType> result, JsonErrors?errors = null)
        {
            var copiedResult = result.copy <SourceContentType, TargetContentType>();
            IMutableServiceResult mutableServiceResult = copiedResult;

            mutableServiceResult.Succeeded = false;

            if (errors != null)
            {
                mutableServiceResult.Errors = errors;
            }

            return(copiedResult);
        }