protected override void ProcessRecordInternal()
        {
            ActionRule result = new ActionRule();

            if (ShouldProcess(
                    target: string.Format(Resources.TargetWithRG, this.Name, this.ResourceGroupName),
                    action: Resources.CreateOrUpdateActionRule_Action))
            {
                switch (ParameterSetName)
                {
                case BySimplifiedFormatActionGroupActionRuleParameterSet:
                    if (ActionRuleType != "ActionGroup")
                    {
                        throw new PSInvalidOperationException(string.Format(Resources.IncorrectActionRuleType_Exception, "ActionGroup"));
                    }

                    // Create Action Rule
                    ActionRule actionGroupAR = new ActionRule(
                        location: "Global",
                        tags: new Dictionary <string, string>(),
                        properties: new ActionGroup(
                            scope: ParseScope(),
                            conditions: ParseConditions(),
                            actionGroupId: ActionGroupId,
                            description: Description,
                            status: Status
                            )
                        );

                    result = this.AlertsManagementClient.ActionRules.CreateUpdateWithHttpMessagesAsync(
                        resourceGroupName: ResourceGroupName, actionRuleName: Name, actionRule: actionGroupAR).Result.Body;
                    break;

                case BySimplifiedFormatSuppressionActionRuleParameterSet:

                    if (ActionRuleType != "Suppression")
                    {
                        throw new PSInvalidOperationException(string.Format(Resources.IncorrectActionRuleType_Exception, "Suppression"));
                    }

                    SuppressionConfig config = new SuppressionConfig(recurrenceType: ReccurenceType);
                    if (ReccurenceType != "Always")
                    {
                        config.Schedule = new SuppressionSchedule(
                            startDate: SuppressionStartTime.Split(' ')[0],
                            endDate: SuppressionEndTime.Split(' ')[0],
                            startTime: SuppressionStartTime.Split(' ')[1],
                            endTime: SuppressionEndTime.Split(' ')[1]
                            );

                        if (ReccurentValue.Length > 0)
                        {
                            config.Schedule.RecurrenceValues = ReccurentValue.OfType <int?>().ToList();
                        }
                    }

                    // Create Action Rule
                    ActionRule suppressionAR = new ActionRule(
                        location: "Global",
                        tags: new Dictionary <string, string>(),
                        properties: new Suppression(
                            scope: ParseScope(),
                            conditions: ParseConditions(),
                            description: Description,
                            status: Status,
                            suppressionConfig: config
                            )
                        );

                    result = this.AlertsManagementClient.ActionRules.CreateUpdateWithHttpMessagesAsync(
                        resourceGroupName: ResourceGroupName, actionRuleName: Name, actionRule: suppressionAR).Result.Body;
                    break;

                case BySimplifiedFormatDiagnosticsActionRuleParameterSet:
                    if (ActionRuleType != "Diagnostics")
                    {
                        throw new PSInvalidOperationException(string.Format(Resources.IncorrectActionRuleType_Exception, "Diagnostics"));
                    }

                    // Create Action Rule
                    ActionRule diagnosticsAR = new ActionRule(
                        location: "Global",
                        tags: new Dictionary <string, string>(),
                        properties: new Diagnostics(
                            scope: ParseScope(),
                            conditions: ParseConditions(),
                            description: Description,
                            status: Status
                            )
                        );

                    result = this.AlertsManagementClient.ActionRules.CreateUpdateWithHttpMessagesAsync(
                        resourceGroupName: ResourceGroupName, actionRuleName: Name, actionRule: diagnosticsAR).Result.Body;

                    break;

                case ByInputObjectParameterSet:
                    ExtractedInfo info = CommonUtils.ExtractFromActionRuleResourceId(InputObject.Id);
                    switch (InputObject.ActionRuleType)
                    {
                    case "ActionGroup":
                        // Create Action Rule
                        PSActionGroupActionRule actionGroupInputObject = (PSActionGroupActionRule)InputObject;
                        ActionRule actionGroupARFromInputObject        = new ActionRule(
                            location: "Global",
                            tags: new Dictionary <string, string>(),
                            properties: new ActionGroup(
                                scope: JsonConvert.DeserializeObject <Scope>(actionGroupInputObject.Scope),
                                conditions: JsonConvert.DeserializeObject <Conditions>(actionGroupInputObject.Conditions),
                                actionGroupId: actionGroupInputObject.ActionGroupId,
                                description: actionGroupInputObject.Description,
                                status: actionGroupInputObject.Status
                                )
                            );

                        result = this.AlertsManagementClient.ActionRules.CreateUpdateWithHttpMessagesAsync(
                            resourceGroupName: info.ResourceGroupName, actionRuleName: info.Resource, actionRule: actionGroupARFromInputObject).Result.Body;
                        break;

                    case "Suppression":
                        PSSuppressionActionRule suppressionInputObject = (PSSuppressionActionRule)InputObject;
                        SuppressionConfig       configFromInputObject  = new SuppressionConfig(recurrenceType: suppressionInputObject.RecurrenceType);
                        if (suppressionInputObject.RecurrenceType != "Always")
                        {
                            configFromInputObject.Schedule = new SuppressionSchedule(
                                startDate: suppressionInputObject.StartDate,
                                endDate: suppressionInputObject.EndDate,
                                startTime: suppressionInputObject.StartTime,
                                endTime: suppressionInputObject.EndTime
                                );

                            if (ReccurentValue.Length > 0)
                            {
                                configFromInputObject.Schedule.RecurrenceValues = suppressionInputObject.RecurrenceValues;
                            }
                        }

                        // Create Action Rule
                        ActionRule suppressionARFromInputObject = new ActionRule(
                            location: "Global",
                            tags: new Dictionary <string, string>(),
                            properties: new Suppression(
                                scope: JsonConvert.DeserializeObject <Scope>(suppressionInputObject.Scope),
                                conditions: JsonConvert.DeserializeObject <Conditions>(suppressionInputObject.Conditions),
                                description: suppressionInputObject.Description,
                                status: suppressionInputObject.Status,
                                suppressionConfig: configFromInputObject
                                )
                            );

                        result = this.AlertsManagementClient.ActionRules.CreateUpdateWithHttpMessagesAsync(
                            resourceGroupName: info.ResourceGroupName, actionRuleName: info.Resource, actionRule: suppressionARFromInputObject).Result.Body;
                        break;

                    case "Diagnostics":
                        // Create Action Rule
                        PSDiagnosticsActionRule diagnosticsInputObject = (PSDiagnosticsActionRule)InputObject;
                        ActionRule diagnosticsARFromInputObject        = new ActionRule(
                            location: "Global",
                            tags: new Dictionary <string, string>(),
                            properties: new Diagnostics(
                                scope: JsonConvert.DeserializeObject <Scope>(diagnosticsInputObject.Scope),
                                conditions: JsonConvert.DeserializeObject <Conditions>(diagnosticsInputObject.Conditions),
                                description: diagnosticsInputObject.Description,
                                status: diagnosticsInputObject.Status
                                )
                            );

                        result = this.AlertsManagementClient.ActionRules.CreateUpdateWithHttpMessagesAsync(
                            resourceGroupName: info.ResourceGroupName, actionRuleName: info.Resource, actionRule: diagnosticsARFromInputObject).Result.Body;
                        break;
                    }
                    break;
                }

                WriteObject(sendToPipeline: TransformOutput(result));
            }
        }