public List <PrivateMessage> GetPrivateMessages(User user, PrivateMessageBoxType boxType, int pageIndex, out PagerContext pagerContext) { var total = PrivateMessageRepository.GetBoxCount(user.UserID, boxType); var pageSize = SettingsManager.Current.TopicsPerPage; var startRow = ((pageIndex - 1) * pageSize) + 1; var totalPages = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(total) / Convert.ToDouble(pageSize))); pagerContext = new PagerContext { PageCount = totalPages, PageIndex = pageIndex, PageSize = pageSize }; return(PrivateMessageRepository.GetPrivateMessages(user.UserID, boxType, startRow, pageSize)); }