public HttpResponseMessage GetCategory(HttpRequestMessage request, int categoryId)
        {
            Category category = _service.GetCategory(categoryId);
            if (category != null)
            {
                CategoryViewModel model = new CategoryViewModel(category);
                return request.CreateResponse<CategoryViewModel>(HttpStatusCode.OK, model);
            }

            return new HttpResponseMessage(HttpStatusCode.NotFound);
        }
        public CategoryWithUnusedViewModel(Category category, List<OrganisationalUnit> allOrganisationalUnits, List<PropertyQueryGroup> allPropertyQueryGroups)
        {
            Category = new CategoryViewModel(category);
            AllOrganisationalUnits = allOrganisationalUnits.Select(o => new OrganisationalUnitInfoViewModel(o)).ToList();
            AllPropertyQueryGroups = allPropertyQueryGroups.Select(p => new PropertyQueryGroupViewModel(p)).ToList();

            for (int i = 0; i < AllOrganisationalUnits.Count; i++)
            {
                Shared.OrganisationalUnitInfoViewModel existing = Category.OrganisationalUnits.Find(cou => cou.OrganisationalUnitId == AllOrganisationalUnits[i].OrganisationalUnitId);
                if (existing != null)
                {
                    AllOrganisationalUnits[i] = new OrganisationalUnitInfoViewModel(existing);
                    AllOrganisationalUnits[i].Use = true;
                }
                //ou.Use = (Category.OrganisationalUnits.Find(cou => cou.OrganisationalUnitId == ou.OrganisationalUnitId) != null);
            }

            for (int i = 0; i < AllPropertyQueryGroups.Count; i++)
            {
                for (int j = 0; j < AllPropertyQueryGroups[i].Queries.Count; j++)
                {
                    Shared.PropertyQueryInfoViewModel existing = Category.Queries.Find(q => q.QueryId == AllPropertyQueryGroups[i].Queries[j].QueryId);
                    if (existing != null)
                    {
                        AllPropertyQueryGroups[i].Queries[j] = new PropertyQueryInfoViewModel(existing, true);
                        AllPropertyQueryGroups[i].AnyQueriesToUse = true;
                    }
                }
            }
            /*
            foreach (PropertyQueryGroupViewModel qg in AllPropertyQueryGroups)
            {
                foreach (PropertyQueryViewModel q in qg.Queries)
                {
                    q.Use = (Category.Queries.Find(cq => cq.WebServiceName == q.WebServiceName && cq.QueryId == q.QueryId) != null);
                    if (q.Use) { qg.AnyQueriesToUse = true; }
                }
            }
            */
        }