private async static Task HardDeleteWithUnitOfWorkAsync<TEntity>( IBasicRepository<TEntity> repository, IEnumerable<TEntity> entities, bool autoSave, CancellationToken cancellationToken, IUnitOfWork currentUow ) where TEntity : class, IEntity, ISoftDelete { var hardDeleteEntities = (HashSet<IEntity>)currentUow.Items.GetOrAdd( UnitOfWorkItemNames.HardDeletedEntities, () => new HashSet<IEntity>() ); hardDeleteEntities.UnionWith(entities); await repository.DeleteManyAsync(entities, autoSave, cancellationToken); }