private DateTime?GetDate()
        {
            IUIUser user = null;

            try
            {
                user = _uiUserProvider.GetUser(_principalAccessor.CurrentName());
            }
            catch
            {
                // We swallow all exceptions because the implementation
                // of _uiUserProvider might throw but that doesnt matter here
            }
            return(user?.CreationDate);
        }
        public async Task <bool> NotifyCmsEditor(ContentReference contentLink, string token, string data, bool isSenderEditModeUser)
        {
            if (!_options.Notifications.NotificationsEnabled)
            {
                return(false);
            }

            var contentVersion = _contentLoader.Get <IContent>(contentLink);

            if (contentVersion == null)
            {
                return(false);
            }

            var comment = _reviewLocationParser.GetLastComment(data);

            var notificationReceiver = (contentVersion as IChangeTrackable).ChangedBy;
            var users = new List <string>
            {
                notificationReceiver
            };

            if (isSenderEditModeUser)
            {
                users.Add(comment.Author);
            }

            var subscribers = users.Select(x => new NotificationUser(x)).ToList();

            // subscribe users to comment
            var subscriptionKey = new Uri($"advancedreviews://notification/{token}");

            await _subscriptionService.SubscribeAsync(subscriptionKey, subscribers).ConfigureAwait(false);

            var recipients = (await _subscriptionService.ListSubscribersAsync(subscriptionKey).ConfigureAwait(false))
                             .Where(u => !u.UserName.Equals(comment.Author, StringComparison.OrdinalIgnoreCase))
                             .ToList();

            if (!recipients.Any())
            {
                return(false);
            }

            // send message
            var model = new ReviewContentNotificationModel
            {
                Title             = contentVersion.Name,
                ContentLink       = contentLink,
                SenderDisplayName = comment.Author,
                Text = comment.Text
            };

            var notificationMessage = new NotificationMessage
            {
                ChannelName = ChannelName,
                Sender      = new NotificationUser(_principalAccessor.CurrentName()),
                Recipients  = recipients,
                Content     = _objectSerializer.Serialize(model)
            };

            try
            {
                await _notifier.PostNotificationAsync(notificationMessage).ConfigureAwait(false);
            }
            catch
            {
                return(false);
            }

            return(true);
        }