public bool MarkUserNotificationAsSeen(string userId, int notificationId) { bool result = false; if (!string.IsNullOrEmpty(userId) && notificationId > 0) { UserNotification userNotification = _context.UserNotifications.DefaultIfEmpty(null).SingleOrDefault(un => un.UserId == userId && un.NotificationId == notificationId); if (userNotification != null) { userNotification.MarkAsSeen(); result = true; } } return(result); }