public async Task <bool> RequestAll(int count) { var profileId = _httpContextAccessor.GetUserIdentifier(); var profiles = _profilesService.GetManyByParameter( e => e.ProfileId == profileId, count ); var profilesDto = profiles .Select(n => n?.ToProfileDto()) .ToList(); await Clients.Caller.SendAsync("ResponseAll", profilesDto); var pipeline = profileId.ToMongoPipelineMatchMany <ProfileEntity>(); var enumerator = _profilesService.SubscribeToChangesMany(pipeline); while (enumerator.MoveNext()) { if (enumerator.Current != null) { await Clients.Caller.SendAsync( "ResponseAll", new List <ProfileDto> { enumerator.Current.FullDocument.ToProfileDto() } ); } } return(true); }