public IPagedList<LibraryItem> GetLibraryItemsByAdvancedSearch(MediatheekAdvancedSearch search)
        {
            string url = ConstructAdvancedSearchUrl(search);
            if (url == null)
            {
                return null;
            }

            using (HttpClient client = new HttpClient())
            {
                string result = client.GetStringAsync(url).Result;
                if (result == null)
                    return null;

                int page = Convert.ToInt32(Math.Floor(Convert.ToDecimal(search.Offset/search.ItemsPerPage) + 1));

                return ConvertAdvancedSearchToPagedList(result, page, search.ItemsPerPage);
            }
        }
        private string ConstructAdvancedSearchUrl(MediatheekAdvancedSearch search)
        {
            if (search.SearchArrays == null || search.SearchArrays.Count == 0)
            {
                return null;
            }

            var b = search.SearchBool + "#" + search.YearReach + "#" + search.Material + "##";
            var f = 0;

            foreach (var searchArray in search.SearchArrays)
            {
                b += f + "-" + searchArray.ToString() + "#";
            }

            if (search.SearchArrays.Count == 0)
            {
                b += "#";
            }

            string searchFields = "zka#" + "advancedsearch_callback" + "#" + search.LibraryCode + "#" + search.Offset + "#" + search.ItemsPerPage + "#s" + search.SortOrder + "s#" + b + "    ";
            return ConstructURL(searchFields);
        }