public GroupCategory ToEntity(GroupCategory existing = null)
        {
            GroupCategory entity = (existing != null ? existing : new GroupCategory());

            entity.Id = this.Id;
            entity.Name = this.Name;

            return entity;
        }
        public GroupCategoryViewModel(GroupCategory entity, bool useCategories = true)
        {
            Id = entity.Id;
            Name = entity.Name;

            if (useCategories)
            {
                Categories = entity.Categories.Select(c => new CategoryViewModel(c)).ToList();
            }
        }
        public bool InsertGroupCategory(GroupCategory groupCategory)
        {
            try
            {
                _unitOfWork.GroupCategoriesRepository.Insert(groupCategory);
                _unitOfWork.Save();
                return true;
            }
            catch { }

            return false;
        }
 public HttpResponseMessage NewGroupCategory(HttpRequestMessage request)
 {
     GroupCategory groupCategory = new GroupCategory();
     GroupCategoryViewModel model = new GroupCategoryViewModel(groupCategory);
     return request.CreateResponse<GroupCategoryViewModel>(HttpStatusCode.OK, model);
 }