public void Reply(PrivateMessage pm, string fullText, User user)
        {
            if (pm == null || pm.PMID == 0)
            {
                throw new ArgumentException("Can't reply to a PM that hasn't been persisted.", "pm");
            }
            if (fullText == null)
            {
                throw new ArgumentNullException("fullText");
            }
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }
            if (!IsUserInPM(user, pm))
            {
                throw new Exception("Can't add a PM reply for a user not part of the PM.");
            }
            var post = new PrivateMessagePost
            {
                FullText = TextParsingService.ForumCodeToHtml(fullText),
                Name     = user.Name,
                PMID     = pm.PMID,
                PostTime = DateTime.UtcNow,
                UserID   = user.UserID
            };

            PrivateMessageRepository.AddPost(post);
            var users = PrivateMessageRepository.GetUsers(pm.PMID);

            foreach (var u in users)
            {
                PrivateMessageRepository.SetArchive(pm.PMID, u.UserID, false);
            }
            var now = DateTime.UtcNow;

            PrivateMessageRepository.UpdateLastPostTime(pm.PMID, now);
            PrivateMessageRepository.SetLastViewTime(pm.PMID, user.UserID, now);
        }
 public void MarkPMRead(User user, PrivateMessage pm)
 {
     PrivateMessageRepository.SetLastViewTime(pm.PMID, user.UserID, DateTime.UtcNow);
 }