public ApiMemberLogItem(MemberLogItem item, IMemberService memberService = null)
        {
            IMemberService ms = memberService ?? ApplicationContext.Current?.Services?.MemberService;

            if (ms == null)
            {
                throw new NullReferenceException($"User service could not be obtained!");
            }

            MemberId = item.UserId;

            IMember member = ms.GetById(MemberId);

            if (member == null)
            {
                MemberName = "none";
            }
            else
            {
                MemberName = member.Name;
                MemberGuid = member.Key;
            }

            Action    = item.Action.GetDisplayName();
            IpAddress = item.IP;

            DateTime localTime = item.Date.ToLocalTime();

            Timestamp = $"{localTime.ToShortDateString()} {localTime.ToLongTimeString()}";
        }
        public static SearchResults <ApiMemberLogItem> Search(MemberFilters filters, DatabaseContext databaseContext = null)
        {
            List <ApiMemberLogItem> items = MemberLogItem.GetAll(databaseContext, filters)
                                            .Select(i => new ApiMemberLogItem(i))
                                            .ToList();

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

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