public override void ExecuteCmdlet() { try { newConfig = new NewBackupPolicyConfig(); newConfig.Name = BackupPolicyName; if (!ProcessParameters()) { return; } if (WaitForComplete.IsPresent) { var taskStatusInfo = StorSimpleClient.CreateBackupPolicy(deviceId, newConfig); HandleSyncTaskResponse(taskStatusInfo, "add"); if (taskStatusInfo.AsyncTaskAggregatedResult == AsyncTaskAggregatedResult.Succeeded) { var createdBackupPolicy = StorSimpleClient.GetBackupPolicyByName(deviceId, BackupPolicyName); WriteObject(createdBackupPolicy.BackupPolicyDetails); } } else { var taskresult = StorSimpleClient.CreateBackupPolicyAsync(deviceId, newConfig); HandleAsyncTaskResponse(taskresult, "add"); } } catch (Exception exception) { this.HandleException(exception); } }