/// <summary>
        /// ProcessRecord of the command.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            try
            {
                RecoveryServicesProviderListResponse recoveryServicesProviderListResponse =
                        RecoveryServicesClient.GetAzureSiteRecoveryProvider(
                        this.Site.Name);

                if (recoveryServicesProviderListResponse.RecoveryServicesProviders.Count != 0)
                {
                    throw new PSInvalidOperationException(Properties.Resources.SiteRemovalWithRegisteredHyperVHostsError);
                }

                FabricDeletionInput input = new FabricDeletionInput()
                {
                    Properties = new FabricDeletionInputProperties()
                };

                LongRunningOperationResponse response =
                 RecoveryServicesClient.DeleteAzureSiteRecoveryFabric(this.Site.Name, input);

                JobResponse jobResponse =
                    RecoveryServicesClient
                    .GetAzureSiteRecoveryJobDetails(PSRecoveryServicesClient.GetJobIdFromReponseLocation(response.Location));

                WriteObject(new ASRJob(jobResponse.Job));
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }
 /// <summary>
 /// Deletes a fabric
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.SiteRecovery.IFabricOperations.
 /// </param>
 /// <param name='fabricName'>
 /// Required. Fabric Name.
 /// </param>
 /// <param name='fabricDeletionInput'>
 /// Required. Fabric deletion input.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// A standard service response for long running operations.
 /// </returns>
 public static Task<LongRunningOperationResponse> DeleteAsync(this IFabricOperations operations, string fabricName, FabricDeletionInput fabricDeletionInput, CustomRequestHeaders customRequestHeaders)
 {
     return operations.DeleteAsync(fabricName, fabricDeletionInput, customRequestHeaders, CancellationToken.None);
 }
 /// <summary>
 /// Deletes a fabric
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.SiteRecovery.IFabricOperations.
 /// </param>
 /// <param name='fabricName'>
 /// Required. Fabric Name.
 /// </param>
 /// <param name='fabricDeletionInput'>
 /// Required. Fabric deletion input.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// A standard service response for long running operations.
 /// </returns>
 public static LongRunningOperationResponse Delete(this IFabricOperations operations, string fabricName, FabricDeletionInput fabricDeletionInput, CustomRequestHeaders customRequestHeaders)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IFabricOperations)s).DeleteAsync(fabricName, fabricDeletionInput, customRequestHeaders);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
 /// <summary>
 /// Deletes Azure Site Recovery Fabric.
 /// </summary>
 /// <param name="createAndAssociatePolicyInput">Policy Input</param>
 /// <returns>Long operation response</returns>
 public LongRunningOperationResponse DeleteAzureSiteRecoveryFabric(string fabricName, FabricDeletionInput input)
 {
     return this.GetSiteRecoveryClient().Fabrics.BeginDeleting(fabricName, input,
         this.GetRequestHeaders());
 }