diff --git a/WebAPI/LearningHub.Nhs.Repository/Resources/BlockCollectionRepository.cs b/WebAPI/LearningHub.Nhs.Repository/Resources/BlockCollectionRepository.cs index 554fdde25..a65b0ddb6 100644 --- a/WebAPI/LearningHub.Nhs.Repository/Resources/BlockCollectionRepository.cs +++ b/WebAPI/LearningHub.Nhs.Repository/Resources/BlockCollectionRepository.cs @@ -83,22 +83,7 @@ public async Task DeleteBlockCollection(int userId, int blockCollectionId) foreach (var id in collectionIds) { - _ = Task.Run(async () => - { - var lhContext = new LearningHubDbContext(this.DbContext.Options); - try - { - await lhContext.Database.ExecuteSqlRawAsync("resources.BlockCollectionDelete @p0", new SqlParameter("@p0", SqlDbType.Int) { Value = id }); - } - catch (Exception ex) - { - throw new Exception(ex.Message); - } - finally - { - await lhContext.DisposeAsync(); - } - }); + await this.DbContext.Database.ExecuteSqlRawAsync("resources.BlockCollectionDelete @p0", new SqlParameter("@p0", SqlDbType.Int) { Value = id }); } }