public async Task <IActionResult> Download(Guid id)
        {
            var fileEntry = await _dispatcher.DispatchAsync(new GetEntityByIdQuery <FileEntry> {
                Id = id
            });

            var content = await _fileManager.ReadAsync(fileEntry);

            return(File(content, MediaTypeNames.Application.Octet, WebUtility.HtmlEncode(fileEntry.FileName)));
        }
        public async Task <IActionResult> Download(Guid id)
        {
            var fileEntry = await _dispatcher.DispatchAsync(new GetEntityByIdQuery <FileEntry> {
                Id = id
            });

            var rawData = await _fileManager.ReadAsync(fileEntry.ToModel());

            var content = fileEntry.Encrypted && fileEntry.FileLocation != "Fake.txt"
                ? rawData
                          .UseAES(fileEntry.EncryptionKey.FromBase64String())
                          .WithCipher(CipherMode.ECB)
                          .WithPadding(PaddingMode.PKCS7)
                          .Decrypt()
                : rawData;

            return(File(content, MediaTypeNames.Application.Octet, WebUtility.HtmlEncode(fileEntry.FileName)));
        }