public TaskDependency(TaskDependency taskDependency)
 {
     this.TaskSpecificationId       = taskDependency.ParentTaskSpecificationId;
     this.ParentTaskSpecificationId = taskDependency.ParentTaskSpecificationId;
     this.TaskSpecification         = new TaskSpecification(taskDependency.TaskSpecification);
     this.ParentTaskSpecification   = new TaskSpecification(taskDependency.ParentTaskSpecification);
 }
        /// <summary>
        /// Usage: Dividing task into smaller parts (Extra Long Tasks)
        /// Warning: copy some references! -> DB 'static' values
        /// </summary>
        /// <param name="taskSpecification"></param>
        public TaskSpecification(TaskSpecification taskSpecification) : base(taskSpecification)
        {
            this.JobArrays               = taskSpecification.JobArrays;
            this.PlacementPolicy         = taskSpecification.PlacementPolicy;
            this.IsExclusive             = taskSpecification.IsExclusive;
            this.IsRerunnable            = taskSpecification.IsRerunnable;
            this.StandardInputFile       = taskSpecification.StandardInputFile;
            this.StandardOutputFile      = taskSpecification.StandardOutputFile;
            this.StandardErrorFile       = taskSpecification.StandardErrorFile;
            this.LocalDirectory          = taskSpecification.LocalDirectory;
            this.ClusterTaskSubdirectory = taskSpecification.ClusterTaskSubdirectory;
            this.CpuHyperThreading       = taskSpecification.CpuHyperThreading;
            this.ProgressFile            = taskSpecification.ProgressFile;
            this.LogFile           = taskSpecification.LogFile;
            this.JobSpecification  = taskSpecification.JobSpecification;
            this.ClusterNodeTypeId = taskSpecification.ClusterNodeTypeId;
            this.ClusterNodeType   = taskSpecification.ClusterNodeType;
            this.CommandTemplateId = taskSpecification.CommandTemplateId;
            this.CommandTemplate   = taskSpecification.CommandTemplate;

            //lists
            this.RequiredNodes = taskSpecification.RequiredNodes?
                                 .Select(x => new TaskSpecificationRequiredNode(x))
                                 .ToList();

            this.CommandParameterValues = taskSpecification.CommandParameterValues?
                                          .Select(x => new CommandTemplateParameterValue(x))
                                          .ToList();

            this.TaskParalizationSpecifications = taskSpecification.TaskParalizationSpecifications?
                                                  .Select(x => new TaskParalizationSpecification(x))
                                                  .ToList();

            this.DependsOn = taskSpecification.DependsOn?
                             .Select(x => new TaskDependency(x))
                             .ToList();

            this.Depended = taskSpecification.Depended?
                            .Select(x => new TaskDependency(x))
                            .ToList();
        }