/// <summary>
        /// Convert submitted task to object for usage reporting
        /// </summary>
        /// <param name="task">Task</param>
        /// <returns></returns>
        internal static SubmittedTaskInfoUsageReport ConvertToUsageReport(this SubmittedTaskInfo task)
        {
            var taskInfoUsageReport = new SubmittedTaskInfoUsageReport
            {
                Id                = task.Id,
                Name              = task.Name,
                Priority          = task.Priority,
                State             = task.State,
                CpuHyperThreading = task.CpuHyperThreading ?? false,
                ScheduledJobId    = task.ScheduledJobId,
                CommandTemplateId = task.Specification.CommandTemplate.Id,
                AllocatedTime     = task.AllocatedTime,
                StartTime         = task.StartTime,
                Usage             = CalculateUsedResourcesForTask(task),
                EndTime           = task.EndTime
            };

            return(taskInfoUsageReport);
        }
        public static SubmittedTaskInfoUsageReportExt ConvertIntToExt(this SubmittedTaskInfoUsageReport taskInfo)
        {
            var taskInfoUsageReportExt = new SubmittedTaskInfoUsageReportExt
            {
                Id                = taskInfo.Id,
                Name              = taskInfo.Name,
                Priority          = taskInfo.Priority.ConvertIntToExt(),
                State             = taskInfo.State.ConvertIntToExt(),
                CpuHyperThreading = taskInfo.CpuHyperThreading ?? false,
                CommandTemplateId = taskInfo.CommandTemplateId,
                ScheduledJobId    = taskInfo.ScheduledJobId,
                AllocatedTime     = taskInfo.AllocatedTime,
                CorehoursUsage    = taskInfo.Usage,
                StartTime         = taskInfo.StartTime,
                EndTime           = taskInfo.EndTime
            };

            return(taskInfoUsageReportExt);
        }