/// <summary>
        /// Submits a task with the specified parameters.
        /// </summary>
        /// <param name="taskId">The unique ID of the task.</param>
        /// <param name="task">The task to submit.</param>
        /// <param name="summary">The summary to associated with the task, if any.</param>
        /// <param name="priority">The priority of the task.</param>
        internal void SubmitTask(Guid taskId, ITask task, ITaskSummary summary, TaskPriority priority)
        {
            if (task == null)
            {
                throw new ArgumentNullException("task");
            }

            Trace.WriteLine("ENTER: Submitting '{0}' with priority '{1}' ...".FormatInvariant(task.GetType().Name, priority));

            string pollingQueueKey = this.configuration.GetPollingQueueKey(task.GetType());

            this.repository.Tasks.Add(taskId, task);

            if (summary != null)
            {
                this.repository.TaskSummary.Add(taskId, summary);
            }

            ITaskRuntimeInfo taskInfo = this.repository.TaskRuntimeInfo.Create(taskId, task.GetType(), this.dateTimeProvider.UtcNow, priority, pollingQueueKey);

            this.repository.TaskRuntimeInfo.Add(taskInfo);

            ITaskMessageBusSender taskMessageBus = this.messageBus.Tasks.GetSender(task.GetType());

            taskMessageBus.NotifyTaskSubmitted(taskId, this.dateTimeProvider.UtcNow, !string.IsNullOrEmpty(pollingQueueKey));

            Trace.WriteLine("EXIT: Task '{0}' submitted with ID '{1}' ...".FormatInvariant(task, taskId));
        }