public async Task <ActionResult> Update(DmsModel model)
        {
            if (ModelState.IsValid)
            {
                //if (model.Department.Id < 1)
                //    return Content("Department is required!");

                var dms = await _dmsService.GetByIdAsync(model.Id);

                if (dms == null)
                {
                    throw new ArgumentException("No dms found with the specified id");
                }
                if (model.DmsCode != dms.DmsCode)
                {
                    var existedDms = await _dmsService.GetDmsByDmsCodeAndDepartmentId(model.DmsCode, model.Department.Id);

                    if (existedDms == null)
                    {
                        dms.DmsCode = model.DmsCode;
                    }
                    else
                    {
                        return(Content("DmsCode has Existed in this Department"));
                    }
                }

                dms.Description = model.Description;
                dms.Note        = model.Note;
                dms.UpdatedDate = DateTime.Now;
                dms.Active      = model.Active;
                dms.Order       = model.Order;

                await _dmsService.UpdateDmsOwner(dms, model.ListUsername);

                return(Json(new { status = "success" }));
            }

            return(Content("Can not edit Dms because model state is invalid"));;
        }