/// <summary>
 /// Gets an <see cref="IUnitOfWork"/> from the given <see cref="IUnitOfWorkFactory"/> and, after
 /// executing the function asynchronously, releases the UoW instance.
 /// The function execution will be encapsulated inside a <see cref="IUnitOfWork.BeginAsync"/>
 /// and <see cref="IUnitOfWork.CommitAsync"/> scope.
 /// </summary>
 /// <typeparam name="TUoW">The <see cref="IUnitOfWork"/> type</typeparam>
 /// <param name="factory">The factory to be used</param>
 /// <param name="toExecute">The action to be executed</param>
 /// <returns>A task that can be awaited</returns>
 /// <exception cref="ArgumentNullException"/>
 /// <exception cref="ConcurrencyException"/>
 /// <exception cref="CommitException"/>
 public static async Task GetAndReleaseAfterExecuteAndCommitAsync <TUoW>(
     this IUnitOfWorkFactory factory, Func <TUoW, Task> toExecute)
     where TUoW : IUnitOfWork
 {
     await factory.GetAndReleaseAfterExecuteAndCommitAsync <IUnitOfWorkFactory, TUoW>(toExecute);
 }
 /// <summary>
 /// Gets an <see cref="IUnitOfWork"/> from the given <see cref="IUnitOfWorkFactory"/> and, after
 /// executing the function asynchronously, releases the UoW instance.
 /// The function execution will be encapsulated inside a <see cref="IUnitOfWork.BeginAsync"/>
 /// and <see cref="IUnitOfWork.CommitAsync"/> scope.
 /// </summary>
 /// <typeparam name="TUoW">The <see cref="IUnitOfWork"/> type</typeparam>
 /// <param name="factory">The factory to be used</param>
 /// <param name="toExecute">The action to be executed</param>
 /// <param name="ct">The cancellation token</param>
 /// <returns>A task that can be awaited</returns>
 /// <exception cref="ArgumentNullException"/>
 /// <exception cref="ConcurrencyException"/>
 /// <exception cref="CommitException"/>
 public static async Task GetAndReleaseAfterExecuteAndCommitAsync <TUoW>(
     this IUnitOfWorkFactory factory, Func <TUoW, CancellationToken, Task> toExecute, CancellationToken ct = default(CancellationToken))
     where TUoW : IUnitOfWork
 {
     await factory.GetAndReleaseAfterExecuteAndCommitAsync <IUnitOfWorkFactory, TUoW>(toExecute, ct);
 }