public async Task <ICollection <CollectionDetails> > GetManyByUserIdAsync(Guid userId) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var query = new UserCollectionDetailsQuery(userId).Run(dbContext); var data = await query.ToListAsync(); return(data.GroupBy(c => c.Id).Select(c => c.First()).ToList()); } }