public ActionResult PostTags(DataSourceRequest command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManagePostTags)) { return(AccessDeniedView()); } var tags = _postTagService.GetAllPostTags() //order by post count .OrderByDescending(x => _postTagService.GetPostCount(x.Id)) .Select(x => new PostTagModel { Id = x.Id, Name = x.Name, PostCount = _postTagService.GetPostCount(x.Id) }) .ToList(); var gridModel = new DataSourceResult { Data = tags.PagedForCommand(command), Total = tags.Count }; return(Json(gridModel)); }