private static Customer createCustomer(string customerName)
        {
            Customer customer = new Customer(customerName);

            AsymmetricEncryptionService asymmetricEncryptionService = new AsymmetricEncryptionService();
            int keySizeBits = 2048;

            AsymmetricKeyPairPersistenceResult asymmetricKeyPairPersistenceResult = asymmetricEncryptionService.PersistNewAsymmetricKeyPair(keySizeBits);

            if (asymmetricKeyPairPersistenceResult.Success)
            {
                customerDictionary.Add(customer.GlobalId.ToString(), asymmetricKeyPairPersistenceResult.PublicPrivateKeyPairXml);

                Console.WriteLine("Public/Private Key Pair");
                Console.WriteLine("------------------------");
                Console.WriteLine(JsonConvert.SerializeObject(customerDictionary) + "\n");
            }
            else
            {
                Console.WriteLine(asymmetricKeyPairPersistenceResult.ExceptionMessage);
            }

            Console.WriteLine("Customer is created successfully");

            return(customer);
        }
        public AsymmetricKeyPairPersistenceResult PersistNewAsymmetricKeyPair(int keySizeBits)
        {
            AsymmetricKeyPairPersistenceResult asymmetricKeyPairPersistenceResult = new AsymmetricKeyPairPersistenceResult();

            try
            {
                RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(keySizeBits);

                asymmetricKeyPairPersistenceResult.Success                 = true;
                asymmetricKeyPairPersistenceResult.PublicKeyXml            = rsaProvider.ToXmlString(false);
                asymmetricKeyPairPersistenceResult.PublicPrivateKeyPairXml = rsaProvider.ToXmlString(true);
            }
            catch (Exception ex)
            {
                asymmetricKeyPairPersistenceResult.ExceptionMessage = ex.Message;
            }

            return(asymmetricKeyPairPersistenceResult);
        }