public OutputData Update(IInputData input, object instance)
        {
            CorpDepartmentProxy dept = instance.Convert <CorpDepartmentProxy>();

            CorpDepartmentCollection deptList;
            var oldDept = FindDept(dept.Id, out deptList);

            oldDept.Name = dept.Name;
            oldDept.Update();
            WeDataUtil.SaveData(WeCorpConst.CORP_DEPT_NAME, deptList);

            return(OutputData.CreateToolkitObject(new KeyData(oldDept)));
        }
        public OutputData Insert(IInputData input, object instance)
        {
            CorpDepartmentProxy dept = instance.Convert <CorpDepartmentProxy>();
            var deptList             = WeDataUtil.GetCacheData <CorpDepartmentCollection>(
                WeCorpConst.CORP_DEPT_NAME);

            var lastNode = deptList.Department[deptList.Department.Count - 1];
            var newDept  = CorpDepartment.Create(dept.ParentId, dept.Name, lastNode.Id + 1);

            deptList.Department.Add(newDept);
            WeDataUtil.SaveData(WeCorpConst.CORP_DEPT_NAME, deptList);

            return(OutputData.CreateToolkitObject(new KeyData(newDept)));
        }