public S3Storage()
        {
            const string filename = "keyxml.pk";
            var          path     = WebServerPathUtils.GetPathTo(Path.Combine("bin", filename));
            var          f        = new FileInfo(path);

            if (f.Exists)
            {
                using (var file = f.OpenRead())
                {
                    var keyString = new StreamReader(file).ReadToEnd();
                    _algorithm = RSA.Create();
                    _algorithm.FromXmlString(keyString);

                    var encryptionMaterials = new EncryptionMaterials(_algorithm);
                    try
                    {
                        _client = new AmazonS3EncryptionClient(encryptionMaterials);

                        var bucket = new S3DirectoryInfo(_client, PdfDocumentsBucketName);
                        if (!bucket.Exists)
                        {
                            bucket.Create();
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Unable to initialize S3 client\n" + ex);
                    }
                }
            }
        }
        public Task <Stream> GetTemplate(IllustrationRequest illustrationRequest)
        {
            var tcs = new TaskCompletionSource <Stream>();

            try
            {
                //var g = illustrationRequest.Gender.HasValue ? illustrationRequest.Gender.Value : Gender.Male;
                //var smoker = illustrationRequest.IsSmoker.HasValue ? illustrationRequest.IsSmoker.Value : false;
                //var age = illustrationRequest.Age.HasValue ? AgeFromBuckets(illustrationRequest.Age.Value) : 18;
                //var requested = illustrationRequest.RequestedCoverage.HasValue ? illustrationRequest.RequestedCoverage.Value : 1000000;

                //var genderString = g == Gender.Male ? "M" : "F";
                //var smokerString = smoker ? "SM" : "NS";
                //var reqString = string.Empty;
                //if (requested <= 250000) reqString = "250K";
                //else if (requested <= 500000) reqString = "500K";
                //else reqString = "1M";

                //var filename = String.Format("{0}-{1}-{2}-{3}.pdf", genderString, smokerString, age, reqString);

                var path = WebServerPathUtils.GetPathTo(Path.Combine("bin", "Documents", "formfill.pdf"));
                var f    = new FileInfo(path);
                var fs   = f.OpenRead();


                tcs.SetResult(fs);
            }
            catch (Exception e)
            {
                tcs.SetException(e);
            }
            return(tcs.Task);
        }