public HttpResponseMessage SaveTree(TreeViewModel viewModel)
        {
            var settingsViewModel = new SettingsViewModel(ActiveModule);

            Tree tree;

            if (viewModel.TreeId == -1)
            {
                tree = new Tree
                {
                    TreeId      = -1,
                    Name        = viewModel.Name,
                    Title       = viewModel.Title,
                    Description = viewModel.Description,
                    OwnerId     = (settingsViewModel.Owner == "user")
                                                ? UserInfo.UserID
                                                : ActiveModule.ModuleID
                };
                _treeService.Add(tree);
            }
            else
            {
                tree             = _treeService.Get(viewModel.TreeId);
                tree.Description = viewModel.Description;
                tree.Name        = viewModel.Name;
                tree.Title       = viewModel.Title;
                if (viewModel.ImageId > 0)
                {
                    tree.ImageId = viewModel.ImageId;
                }
                _treeService.Update(tree);
            }

            var response = new
            {
                treeId = tree.TreeId
            };

            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }