public static SearchResults <ApiMemberAccessLogItem> Search(MemberAccessLogFilters filters, DatabaseContext databaseContext, IMemberService memberService, IUserService userService)
        {
            List <ApiMemberAccessLogItem> items = MemberAccessLogItem.GetAll(databaseContext, filters)
                                                  .Select(i => new ApiMemberAccessLogItem(i, memberService, userService))
                                                  .ToList();

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

            return(new SearchResults <ApiMemberAccessLogItem>(page, items.Count, filters.Page, filters.PageSize));
        }
        public ApiMemberAccessLogItem(MemberAccessLogItem item, IMemberService memberService, IUserService userService)
        {
            MemberId = item.MemberId;

            IMember member = memberService.GetByKey(MemberId);

            MemberName = member.Name ?? "none";

            UserId = item.UserId;
            IUser user = userService.GetUserById(UserId);

            UserName = user?.Name ?? "none";

            Action    = item.Action;
            IpAddress = item.IpAddress;

            DateTime localTime = item.Timestamp.ToLocalTime();

            Timestamp = $"{localTime.ToShortDateString()} {localTime.ToLongTimeString()}";
        }