/// <summary>Create the table batch operation for the scheduled entity for the set of virtual machines.</summary>
        /// <param name="filteredVmSet">Set of virtual machines.</param>
        /// <param name="schedulerFrequency">Schedule frequency, it will be reading from the config</param>
        /// <param name="virtualMachineGroup"></param>
        /// <returns></returns>
        public static TableBatchOperation CreateScheduleEntity(IList <VirtualMachineCrawlerResponse> filteredVmSet,
                                                               int schedulerFrequency, List <string> azureFiOperationList, VirtualMachineGroup virtualMachineGroup)
        {
            TableBatchOperation tableBatchOperation = new TableBatchOperation();
            Random   random = new Random();
            DateTime randomExecutionDateTime = DateTime.UtcNow.AddMinutes(random.Next(1, schedulerFrequency));
            var      sessionId = Guid.NewGuid().ToString();

            foreach (var item in filteredVmSet)
            {
                if (item == null)
                {
                    continue;
                }

                string fiOperation = string.Empty;
                var    actionType  = GetActionType(item.RowKey, azureFiOperationList, item.State, out fiOperation);
                var    entityEntry = RuleEngineHelper.ConvertToScheduledRuleEntity(item, sessionId, actionType,
                                                                                   fiOperation, randomExecutionDateTime, virtualMachineGroup);
                if (entityEntry != null)
                {
                    tableBatchOperation.InsertOrMerge(entityEntry);
                }
            }

            return(tableBatchOperation);
        }
        public static TableBatchOperation CreateScheduleEntityForAvailabilitySet(IList <VirtualMachineCrawlerResponse> filteredVmSet,
                                                                                 int schedulerFrequency, List <string> azureFiOperationList, bool domainFlage)
        {
            var tableBatchOperation = new TableBatchOperation();
            var random = new Random();
            var randomExecutionDateTime = DateTime.UtcNow.AddMinutes(random.Next(1, schedulerFrequency));
            var sessionId = Guid.NewGuid().ToString();

            foreach (var item in filteredVmSet)
            {
                if (item == null)
                {
                    continue;
                }

                string fiOperation = string.Empty;
                var    actionType  = GetActionType(item.RowKey, azureFiOperationList, item.State, out fiOperation);

                tableBatchOperation.InsertOrMerge(RuleEngineHelper.ConvertToScheduledRuleEntityForAvailabilitySet(item,
                                                                                                                  sessionId, actionType, fiOperation, randomExecutionDateTime, domainFlage));
            }

            return(tableBatchOperation);
        }