internal static TaskAggregateStoreObject FromDarTaskAggregate(DarTaskAggregate taskAggregate, StoreObjectProvider objectProvider)
        {
            if (taskAggregate == null)
            {
                throw new ArgumentNullException("taskAggregate");
            }
            if (objectProvider == null)
            {
                throw new ArgumentNullException("objectProvider");
            }
            TaskAggregateStoreObject taskAggregateStoreObject = taskAggregate.WorkloadContext as TaskAggregateStoreObject;

            if (taskAggregateStoreObject == null)
            {
                taskAggregateStoreObject = objectProvider.FindByAlternativeId <TaskAggregateStoreObject>(taskAggregate.Id);
                if (taskAggregateStoreObject == null)
                {
                    taskAggregateStoreObject = new TaskAggregateStoreObject();
                }
            }
            if (taskAggregateStoreObject != null)
            {
                taskAggregateStoreObject.UpdateFromDarTaskAggregate(taskAggregate);
            }
            return(taskAggregateStoreObject);
        }
        internal static TaskAggregateStoreObject FromExistingObject(TaskAggregateStoreObject storeObject, StoreObjectProvider objectProvider)
        {
            TaskAggregateStoreObject taskAggregateStoreObject = objectProvider.FindByAlternativeId <TaskAggregateStoreObject>(storeObject.Id);

            taskAggregateStoreObject.Id                  = storeObject.Id;
            taskAggregateStoreObject.Enabled             = storeObject.Enabled;
            taskAggregateStoreObject.TaskType            = storeObject.TaskType;
            taskAggregateStoreObject.ScopeId             = storeObject.ScopeId;
            taskAggregateStoreObject.MaxRunningTasks     = storeObject.MaxRunningTasks;
            taskAggregateStoreObject.RecurrenceType      = storeObject.RecurrenceType;
            taskAggregateStoreObject.RecurrenceFrequency = storeObject.RecurrenceFrequency;
            taskAggregateStoreObject.RecurrenceInterval  = storeObject.RecurrenceInterval;
            return(taskAggregateStoreObject);
        }