diff --git a/EnvelopeGenerator.Application/Common/Extensions/MediatorExtensions.cs b/EnvelopeGenerator.Application/Common/Extensions/MediatorExtensions.cs
index ea971903..b0a09668 100644
--- a/EnvelopeGenerator.Application/Common/Extensions/MediatorExtensions.cs
+++ b/EnvelopeGenerator.Application/Common/Extensions/MediatorExtensions.cs
@@ -9,6 +9,32 @@ namespace EnvelopeGenerator.Application.Common.Extensions;
///
public static class MediatorExtensions
{
+ ///
+ /// Sends a request via MediatR and throws a custom exception produced by
+ /// when the response is null or an empty collection.
+ ///
+ /// The expected response type.
+ /// The exception type to throw.
+ /// The mediator instance.
+ /// The MediatR request whose response may be null.
+ /// A factory that creates the exception to throw when the response is absent.
+ /// Cancellation token.
+ /// A guaranteed non-null .
+ /// The exception produced by .
+ public static async Task SendOrThrowAsync(this IMediator mediator, IRequest request, Func exceptionFactory, CancellationToken cancel = default)
+ where TException : Exception
+ {
+ if (await mediator.Send(request, cancel) is TResponse res)
+ {
+ if (res is not string && res is IEnumerable enumerable && !enumerable.Cast