public async Task UpdateProductInIdentifyService([QueueTrigger(QueueNames.UpdateProduct, Connection = "StorageProdIden")]
                                                         UpdateProductMessage message, ILogger log)
        {
            var product = await _productRepository.Get(message.ProductId);

            var folder = product.StoragePathVerified();

            var fileNames = await _fileRepository.FileNamesList(folder);

            if (!fileNames.Any())
            {
                throw new Exception($"There are no verified files in folder: [{folder}] for product: [{product.Id}]");
            }

            var images = new List <Stream>();

            foreach (var fileName in fileNames)
            {
                var file = await _fileRepository.GetFileContentAsync(folder, fileName);

                images.Add(file);
            }

            await _productIdentifyService.UpdateProduct(images, product);

            var productTrainingModel = new ProductTrainingModel(message.ProductId);

            _productTrainingRepository.Add(productTrainingModel);

            foreach (var fileName in fileNames)
            {
                await _fileRepository.CopyFile(folder, product.StoragePathAddedAfterVerification(), fileName);
            }
        }
        public async Task AddProductToIdentifyService([QueueTrigger(QueueNames.AddProduct, Connection = "StorageProdIden")]
                                                      AddProductMessage message, ILogger log)
        {
            log.LogInformation("AddProductToIdentifyService function called");
            log.LogInformation($"Message: {message}");

            var product = await _productRepository.Get(message.ProductId);

            var folder = product.StoragePathOriginal();

            var fileNames = await _fileRepository.FileNamesList(folder);

            if (!fileNames.Any())
            {
                throw new Exception($"There are no original files in folder: [{folder}] for product: [{product.Id}]");
            }

            var images = new List <Stream>();

            foreach (var fileName in fileNames)
            {
                var file = await _fileRepository.GetFileContentAsync(folder, fileName);

                images.Add(file);
            }

            var updatedProduct = await _productIdentifyService.AddProduct(images, product);

            await _productRepository.UpdateProductAsync(updatedProduct);

            var productTrainingModel = new ProductTrainingModel(message.ProductId);

            _productTrainingRepository.Add(productTrainingModel);
        }
        public void Delete(ProductTrainingModel productTrainingModel)
        {
            var operation = TableOperation.Delete(productTrainingModel);

            _table.ExecuteAsync(operation);
        }
        public void Add(ProductTrainingModel productTrainingModel)
        {
            var operation = TableOperation.Insert(productTrainingModel);

            _table.ExecuteAsync(operation);
        }
        public void Update(ProductTrainingModel productTrainingModel)
        {
            var operation = TableOperation.InsertOrMerge(productTrainingModel);

            _table.ExecuteAsync(operation);
        }