public void Validate(UpdateStorageItemDto itemUpdate)
        {
            if (itemUpdate == null)
            {
                throw new BadRequestCustomException("Request body cannot be empty");
            }
            if (itemUpdate.Id == -1)
            {
                throw new BadRequestCustomException("Request must have an associated item id.");
            }

            EnsureExists(itemUpdate.Id);

            if (ItemIsFolder(itemUpdate.Id) && itemUpdate.Data != null)
            {
                throw new BadRequestCustomException("Folder cannot contain data");
            }

            if (itemUpdate.Name != null && itemUpdate.Name.Length == 0)
            {
                throw new BadRequestCustomException("Item must have a name");
            }

            //Operation Validation
            if (NameExistsInFolder(itemUpdate.Name, itemUpdate.FolderId))
            {
                throw new NameTakenException(itemUpdate.Name);
            }

            if (!ItemIsFolder(itemUpdate.FolderId))
            {
                throw new BadRequestCustomException($"Id {itemUpdate.FolderId} is not a folder");
            }
        }
        public StorageItem UpdateItem(UpdateStorageItemDto update)
        {
            var storageItem = GetById(update.Id);

            if (update.Data != null)
            {
                Files.WriteToFile(storageItem.Guid, update.Data);
            }

            // if (update.FolderId != -1)
            // {
            //   storageItem.FolderId = update.FolderId;
            // }

            // if (update.Name.Length > 0)
            // {
            //   storageItem.Name = update.Name;
            // }

            if (update.IsTrash)
            {
                storageItem.IsTrash = update.IsTrash;
            }

            if (!update.IsTrash)
            {
                storageItem.IsTrash = update.IsTrash;
            }

            return(storageItem);
        }