public ActionResult Index(int?p)
 {
     if (LoggedOnUser.DisablePrivateMessages == true)
     {
         TempData[AppConstants.MessageViewBagName] = new GenericMessageViewModel
         {
             Message     = LocalizationService.GetResourceString("Errors.NoPermission"),
             MessageType = GenericMessages.danger
         };
         return(RedirectToAction("Index", "Home"));
     }
     using (UnitOfWorkManager.NewUnitOfWork())
     {
         var pageIndex     = p ?? 1;
         var pagedMessages = _privateMessageService.GetPagedReceivedMessagesByUser(pageIndex, SiteConstants.PrivateMessageListSize, LoggedOnUser);
         var viewModel     = new ListPrivateMessageViewModel
         {
             Messages   = pagedMessages,
             PageIndex  = pageIndex,
             TotalCount = pagedMessages.TotalCount
         };
         return(View(viewModel));
     }
 }