public async Task <bool> SyncStorage(string localFileStorage)
        {
            try
            {
                if (!_directory.Exists(localFileStorage))
                {
                    _directory.CreateDirectory(localFileStorage);
                }
                _logger.LogInformation($"Start Syncing from Blob Storage");

                var files = await _blobFileRepository.GetFileNameListFromBlobStorageAsyc().ConfigureAwait(false);

                if (files != null && files.ToList().Count > 0)
                {
                    _logger.LogInformation($"Total private keys file number : '{files.ToList().Count}'");
                    int count = 0;

                    foreach (var file in files)
                    {
                        _logger.LogInformation($"Start processing file : '{file.Name}'");
                        var responseFile = await _blobFileRepository.DownloadFileToByteArrayAsync(file.Name).ConfigureAwait(false);

                        if (!_fileHandler.Exists($"{localFileStorage}/{file.Name}"))
                        {
                            _fileHandler.Save(localFileStorage, responseFile);
                            count++;
                        }
                        else
                        {
                            _logger.LogInformation($"'{file.Name}' is already exist on local storage");
                        }
                    }

                    _logger.LogInformation($"Total processed file number : '{count}'");
                }
                else
                {
                    _logger.LogInformation($"No file exist to sync on Blob Storage");
                }
                return(true);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"Failed to synced files from blob storage.");
                throw;
            }
        }
        public Key GeneratepPotectKey(string location)
        {
            if (!_fileHandler.DirectoryExists(location))
            {
                _fileHandler.CreateDirectory(location);
            }
            string KeyFileName = Guid.NewGuid().ToString();
            Key    keyFile     = new Key();
            RSACryptoServiceProvider Algorithm = new RSACryptoServiceProvider(_keySize);
            string CompleteKey = Algorithm.ToXmlString(true);

            byte[] KeyBytes = Encoding.UTF8.GetBytes(CompleteKey);

            KeyBytes = ProtectedData.Protect(KeyBytes,
                                             null, DataProtectionScope.LocalMachine);

            keyFile.PublicKey = Algorithm.ToXmlString(false);
            keyFile.FileName  = $"{KeyFileName}.config";
            _fileHandler.Save(location, keyFile, KeyBytes);

            return(keyFile);
        }