/// <summary>
        /// Persists a task's progress information to the task store
        /// </summary>
        /// <param name="progress">Percentual progress. Can be <c>null</c> or a value between 0 and 100.</param>
        /// <param name="message">Progress message. Can be <c>null</c>.</param>
        /// <param name="immediately">if <c>true</c>, saves the updated task entity immediately, or lazily with the next commit otherwise.</param>
        public virtual async Task SetProgressAsync(int?progress, string message, bool immediately = false)
        {
            if (progress.HasValue)
            {
                Guard.InRange(progress.Value, 0, 100, nameof(progress));
            }

            // Update cloned task.
            ExecutionInfo.ProgressPercent = progress;
            ExecutionInfo.ProgressMessage = message;

            // Update original task.
            _originalExecutionInfo.ProgressPercent = progress;
            _originalExecutionInfo.ProgressMessage = message;

            if (immediately)
            {
                // Dont't let this abort the task on failure.
                try
                {
                    await TaskStore.UpdateExecutionInfoAsync(_originalExecutionInfo);
                }
                catch
                {
                }
            }
        }