public UserDashboardViewModel(IUserService userService, DatabaseContext databaseContext)
        {
            Filters = new UserFilters
            {
                From     = DateTime.Today.AddMonths(-1),
                To       = DateTime.Today,
                Page     = 1,
                PageSize = 10
            };

            SearchResults = ApiUserLogItem.Search(Filters, databaseContext, userService);

            Users = userService
                    .GetAll(0, int.MaxValue, out int _)
                    .OrderBy(u => u.Name)
                    .Select(u => new ApiUser
            {
                Id   = u.Id,
                Name = u.Name
            });

            Events = Enums.Values <AuditEvent>()
                     .ToDictionary(ae => (int)ae, ae => ae.GetDisplayName())
                     .ToList();
        }
        public static SearchResults <ApiUserLogItem> Search(UserFilters filters, DatabaseContext databaseContext, IUserService userService)
        {
            List <ApiUserLogItem> items = UserLogItem.GetAll(databaseContext, filters)
                                          .Select(i => new ApiUserLogItem(i, userService))
                                          .ToList();

            IEnumerable <ApiUserLogItem> page = items.Skip((filters.Page - 1) * filters.PageSize).Take(filters.PageSize);

            return(new SearchResults <ApiUserLogItem>(page, items.Count, filters.Page, filters.PageSize));
        }