public NotifierData GetNotifierData <TActivity>(TActivity activity, Enum notificationType)
            where TActivity : IIntranetActivity, IHaveOwner
        {
            var currentMemberId = new Lazy <Guid>(() => _intranetMemberService.GetCurrentMemberId());
            var data            = new NotifierData
            {
                NotificationType = notificationType,
                ActivityType     = activity.Type,
            };

            switch (notificationType)
            {
            case ActivityLikeAdded:
                data.Value       = _notifierDataHelper.GetLikesNotifierDataModel(activity, notificationType, currentMemberId.Value);
                data.ReceiverIds = ReceiverIds(activity, notificationType).Except(new[] { currentMemberId.Value });
                break;

            case BeforeStart:
                data.Value       = _notifierDataHelper.GetActivityReminderDataModel(activity, notificationType);
                data.ReceiverIds = ReceiverIds(activity, notificationType);
                break;

            case EventHidden:
            case EventUpdated:
                data.Value       = _notifierDataHelper.GetActivityNotifierDataModel(activity, notificationType, currentMemberId.Value);
                data.ReceiverIds = ReceiverIds(activity, notificationType).Except(new[] { currentMemberId.Value });
                break;

            default:
                throw new InvalidOperationException();
            }

            return(data);
        }
        internal INotifierDataValue GetNotifierDataValue(OldNotifierData oldData, IIntranetActivity activity, Enum notificationType)
        {
            INotifierDataValue result;

            switch (notificationType)
            {
            case NotificationTypeEnum.ActivityLikeAdded:
            {
                result = _notifierDataHelper.GetLikesNotifierDataModel(activity, notificationType, oldData.NotifierId);
                break;
            }

            case NotificationTypeEnum.CommentAdded:
            case NotificationTypeEnum.CommentReplied:
            case NotificationTypeEnum.CommentEdited:
            case NotificationTypeEnum.CommentLikeAdded:
            {
                var commentId = ParseCommentId(oldData.Url);
                var comment   = _commentsService.Get(commentId);
                result = _notifierDataHelper.GetCommentNotifierDataModel(activity, comment, notificationType, oldData.NotifierId);
                break;
            }

            case NotificationTypeEnum.BeforeStart:
            {
                result = _notifierDataHelper.GetActivityReminderDataModel(activity, notificationType);
                break;
            }

            case NotificationTypeEnum.EventHided:
            case NotificationTypeEnum.EventUpdated:
            {
                result = _notifierDataHelper.GetActivityNotifierDataModel(activity, notificationType, oldData.NotifierId);
                break;
            }

            default:
                result = null;
                break;
            }

            return(result);
        }
        private NotifierData GetNotifierData(Guid entityId, Enum notificationType)
        {
            var currentUser = _intranetUserService.GetCurrentUser();

            var data = new NotifierData
            {
                NotificationType = notificationType,
                ActivityType     = Type
            };

            switch (notificationType)
            {
            case NotificationTypeEnum.CommentReplied:
            {
                var comment      = _commentsService.Get(entityId);
                var currentEvent = Get(comment.ActivityId);
                data.ReceiverIds = comment.UserId.ToEnumerable();
                data.Value       = _notifierDataHelper.GetCommentNotifierDataModel(currentEvent, comment, notificationType, currentUser.Id);
            }
            break;

            case NotificationTypeEnum.CommentEdited:
            {
                var comment      = _commentsService.Get(entityId);
                var currentEvent = Get(comment.ActivityId);
                data.ReceiverIds = currentEvent.OwnerId.ToEnumerable();
                data.Value       = _notifierDataHelper.GetCommentNotifierDataModel(currentEvent, comment, notificationType, comment.UserId);
            }
            break;

            case NotificationTypeEnum.CommentAdded:
            {
                var comment      = _commentsService.Get(entityId);
                var currentEvent = Get(comment.ActivityId);
                data.ReceiverIds = GetNotifiedSubscribers(currentEvent).Concat(currentEvent.OwnerId.ToEnumerable()).Distinct();
                data.Value       = _notifierDataHelper.GetCommentNotifierDataModel(currentEvent, comment, notificationType, comment.UserId);
            }
            break;

            case NotificationTypeEnum.ActivityLikeAdded:
            {
                var currentEvent = Get(entityId);
                data.ReceiverIds = currentEvent.OwnerId.ToEnumerable();
                data.Value       = _notifierDataHelper.GetLikesNotifierDataModel(currentEvent, notificationType, currentUser.Id);
            }
            break;

            case NotificationTypeEnum.CommentLikeAdded:
            {
                var comment      = _commentsService.Get(entityId);
                var currentEvent = Get(comment.ActivityId);
                data.ReceiverIds = currentUser.Id == comment.UserId ? Enumerable.Empty <Guid>() : comment.UserId.ToEnumerable();
                data.Value       = _notifierDataHelper.GetCommentNotifierDataModel(currentEvent, comment, notificationType, currentUser.Id);
            }
            break;

            case NotificationTypeEnum.BeforeStart:
            {
                var currentEvent = Get(entityId);
                data.ReceiverIds = GetNotifiedSubscribers(currentEvent);
                data.Value       = _notifierDataHelper.GetActivityReminderDataModel(currentEvent, notificationType);
            }
            break;

            case NotificationTypeEnum.EventHided:
            case NotificationTypeEnum.EventUpdated:
            {
                var currentEvent = Get(entityId);
                data.ReceiverIds = GetNotifiedSubscribers(currentEvent);
                data.Value       = _notifierDataHelper.GetActivityNotifierDataModel(currentEvent, notificationType, currentUser.Id);
            }
            break;

            default:
                return(null);
            }
            return(data);
        }