/// <summary>
        /// Convert a Management.Sql.Models.TransparentDataEncryption.EncryptionProtector to AzureSqlServerTransparentDataEncryptionProtectorModel
        /// </summary>
        /// <param name="resourceGroup">The resource group the server is in</param>
        /// <param name="serverName">The name of the server</param>
        /// <param name="resp">The management client server response to convert</param>
        /// <returns>The converted server model</returns>
        private static AzureSqlServerTransparentDataEncryptionProtectorModel CreateEncryptionProtectorModelFromResponse(string resourceGroup, string serverName, EncryptionProtector resp)
        {
            AzureSqlServerTransparentDataEncryptionProtectorModel EncryptionProtector = new AzureSqlServerTransparentDataEncryptionProtectorModel();

            EncryptionProtector.ResourceGroupName     = resourceGroup;
            EncryptionProtector.ServerName            = serverName;
            EncryptionProtector.ServerKeyVaultKeyName = resp.Properties.ServerKeyName;
            Model.EncryptionProtectorType type = Model.EncryptionProtectorType.ServiceManaged;
            Enum.TryParse <Model.EncryptionProtectorType>(resp.Properties.ServerKeyType, true, out type);
            EncryptionProtector.Type = type;

            if (type == Model.EncryptionProtectorType.AzureKeyVault)
            {
                EncryptionProtector.KeyId = resp.Properties.Uri;
            }

            return(EncryptionProtector);
        }
        /// <summary>
        /// Creates or Updates an encryption protector
        /// </summary>
        /// <param name="model">The encryption protector model to create or update</param>
        /// <returns>The created or updated encryption protector model</returns>
        public AzureSqlServerTransparentDataEncryptionProtectorModel CreateOrUpdateEncryptionProtector(AzureSqlServerTransparentDataEncryptionProtectorModel model)
        {
            var resp = Communicator.CreateOrUpdateEncryptionProtector(model.ResourceGroupName, model.ServerName, Util.GenerateTracingId(), new EncryptionProtectorCreateOrUpdateParameters()
            {
                Properties = new EncryptionProtectorCreateOrUpdateProperties()
                {
                    ServerKeyType = model.Type.ToString(),
                    ServerKeyName = model.ServerKeyVaultKeyName
                }
            });

            return(CreateEncryptionProtectorModelFromResponse(model.ResourceGroupName, model.ServerName, resp));
        }
        /// <summary>
        /// Creates or Updates an encryption protector
        /// </summary>
        /// <param name="model">The encryption protector model to create or update</param>
        /// <returns>The created or updated encryption protector model</returns>
        public AzureSqlServerTransparentDataEncryptionProtectorModel CreateOrUpdateEncryptionProtector(AzureSqlServerTransparentDataEncryptionProtectorModel model)
        {
            var resp = Communicator.CreateOrUpdateEncryptionProtector(model.ResourceGroupName, model.ServerName, new Management.Sql.Models.EncryptionProtector()
            {
                ServerKeyType       = model.Type.ToString(),
                ServerKeyName       = model.ServerKeyVaultKeyName,
                AutoRotationEnabled = model.AutoRotationEnabled
            });

            return(CreateEncryptionProtectorModelFromResponse(model.ResourceGroupName, model.ServerName, resp));
        }