public async Task <ActionResultResponse> Update(string tenantId,
                                                        string lastUpdateUserId, string lastUpdateFullName, int folderId, FolderMeta folderMeta)
        {
            var folderInfo = await _folderRepository.GetInfo(tenantId, lastUpdateUserId, folderId);

            if (folderInfo == null)
            {
                return(new ActionResultResponse(-2, _fileManagermentResourceResource.GetString("Folder info does not exists. Please try again.")));
            }

            if (folderInfo.TenantId != tenantId)
            {
                return(new ActionResultResponse(-3, _sharedResourceService.GetString(ErrorMessage.NotHavePermission)));
            }

            if (folderInfo.ConcurrencyStamp != folderMeta.ConcurrencyStamp)
            {
                return(new ActionResultResponse(-4,
                                                _sharedResourceService.GetString("The folder already updated by other people. You can not update this folder.")));
            }

            if (folderMeta.ParentId.HasValue && folderInfo.Id == folderMeta.ParentId.Value)
            {
                return(new ActionResultResponse(-5, _fileManagermentResourceResource.GetString("Folder and parent folder can not be the same.")));
            }
            ;

            var oldParentId = folderInfo.ParentId;
            var oldIdPath   = folderInfo.IdPath;

            folderInfo.Name = folderMeta.Name;
            //folderInfo.Order = folderMeta.Order;
            folderInfo.ConcurrencyStamp   = Guid.NewGuid().ToString();
            folderInfo.LastUpdate         = DateTime.Now;
            folderInfo.LastUpdateUserId   = lastUpdateUserId;
            folderInfo.LastUpdateFullName = lastUpdateFullName;
            folderInfo.UnsignName         = folderMeta.Name.Trim().StripVietnameseChars().ToUpper();

            if (await _folderRepository.CheckName(tenantId, folderInfo.UnsignName))
            {
                return(new ActionResultResponse <Folder>(-2,
                                                         _fileManagermentResourceResource.GetString("This folder does exists. Please try again.")));
            }

            if (folderInfo.ParentId.HasValue && !folderMeta.ParentId.HasValue)
            {
                folderInfo.ParentId = null;
                folderInfo.IdPath   = folderInfo.Id.ToString();
                //folderInfo.OrderPath = folderInfo.Order.ToString();
            }
            else if (folderMeta.ParentId.HasValue && folderMeta.ParentId != folderInfo.ParentId)
            {
                var parentInfo = await _folderRepository.GetInfo(tenantId, lastUpdateUserId, folderMeta.ParentId.Value);

                if (parentInfo == null)
                {
                    return(new ActionResultResponse(-6, _fileManagermentResourceResource.GetString("Parent folder does not exists. Please try again.")));
                }
                ;

                parentInfo.IdPath   = $"{parentInfo.IdPath}.{parentInfo.Id}";
                parentInfo.ParentId = parentInfo.Id;
                //parentInfo.OrderPath = $"{parentInfo.OrderPath}.{parentInfo.Order}";
            }

            await _folderRepository.Update(folderInfo);

            // Update children IdPath and RootInfo
            if (folderInfo.IdPath != oldIdPath)
            {
                await _folderRepository.UpdateChildrenIdPath(oldIdPath, folderInfo.IdPath);
            }

            // Update parent survey group child count.
            if (folderInfo.ParentId.HasValue && oldParentId.HasValue && folderInfo.ParentId.Value != oldParentId.Value)
            {
                // Update old parent survey group child count.
                var oldChildCount = await _folderRepository.GetChildCount(oldParentId.Value);

                await _folderRepository.UpdateChildCount(tenantId, lastUpdateUserId, oldParentId.Value, oldChildCount);

                // Update new parent survey group child count.
                var newParentId   = folderInfo.ParentId.Value;
                var newChildCount = await _folderRepository.GetChildCount(newParentId);

                await _folderRepository.UpdateChildCount(tenantId, lastUpdateUserId, newParentId, newChildCount);
            }

            //update lai folder child by Id
            var childCountid = await _folderRepository.GetChildCount(folderInfo.Id);

            await _folderRepository.UpdateChildCount(tenantId, lastUpdateUserId, folderInfo.Id, childCountid);

            //// Update survey group name translation in survey translation.
            //if (surveyGroupMeta.SurveyGroupTranslations.Any())
            //    await UpdateSurveyTranslations();

            return(new ActionResultResponse(1,
                                            _fileManagermentResourceResource.GetString("Update folder name successful.")));
        }