/// <summary> /// Notify all followers of a user that a new vlog was posted. /// </summary> /// <remarks> /// A notification background task is dispatched to the /// <see cref="DispatchManager"/> for each follower. /// </remarks> /// <param name="vlogOwnerUserId">Owner of the vlog.</param> /// <param name="vlogId">The posted vlog id.</param> public virtual async Task NotifyFollowersVlogPostedAsync(Guid vlogOwnerUserId, Guid vlogId) { _logger.LogTrace($"Notifying followers that {vlogOwnerUserId} posted vlog {vlogId}"); await foreach (var user in _userRepository.GetFollowersAsync(vlogOwnerUserId, Navigation.All)) { var notification = _notificationFactory.BuildFollowedProfileVlogPosted(user.Id, vlogId, vlogOwnerUserId); _logger.LogTrace($"Notifying follower {user.Id} that {vlogOwnerUserId} posted a vlog"); _dispatchManager.Dispatch <NotifyBackgroundTask <DataFollowedProfileVlogPosted> >(notification); } }