private async Task <Tuple <int, DateTime?> > GetUnreadNotificationsCountAndLastTimestampAsync(string userId, FeedNotificationTransport transport, DateTime?from = null) { var realFrom = from ?? await feedRepo.GetFeedViewTimestampAsync(userId, transport.Id) ?? DateTime.MinValue; var unreadCount = await feedRepo.GetNotificationsCountAsync(userId, realFrom, transport); if (unreadCount > 0) { from = await feedRepo.GetLastDeliveryTimestampAsync(transport); } return(Tuple.Create(unreadCount, from)); }