internal static HomogenousMap GetGroups(IOwinContext context, ISet <Guid> necessaryMIATypes, AttributeSpecification attribute, IFilter filter = null)
        {
            Guid?   user         = ResourceAccessUtils.GetUser(context);
            IFilter searchFilter = ResourceAccessUtils.AppendUserFilter(user, filter, necessaryMIATypes);

            return(MediaLibrary.GetValueGroups(attribute, filter, ProjectionFunction.None, necessaryMIATypes, searchFilter, true, false));
        }
        internal static int CountMediaItems(IOwinContext context, ISet <Guid> necessaryMIATypes, IFilter filter = null)
        {
            Guid?   user         = ResourceAccessUtils.GetUser(context);
            IFilter searchFilter = ResourceAccessUtils.AppendUserFilter(user, filter, necessaryMIATypes);

            return(MediaLibrary.CountMediaItems(necessaryMIATypes, searchFilter, false, false));
        }
        internal static IList <MediaItem> Search(IOwinContext context, ISet <Guid> necessaryMIATypes, ISet <Guid> optionalMIATypes, IFilter filter, uint?limit = null)
        {
            Guid?          user         = ResourceAccessUtils.GetUser(context);
            IFilter        searchFilter = ResourceAccessUtils.AppendUserFilter(user, filter, necessaryMIATypes);
            MediaItemQuery searchQuery  = new MediaItemQuery(necessaryMIATypes, optionalMIATypes, searchFilter)
            {
                Limit = limit
            };

            return(MediaLibrary.Search(searchQuery, false, user, false));
        }