/// <summary>
        /// Create the results and task for a survey
        /// </summary>
        /// <param name="survey">The survey</param>
        /// <param name="recipient">The recipient</param>
        /// <param name="dueInDays">Task due, zero indicates no due date</param>
        /// <param name="taskName">If not null or empty, use as task name</param>
        /// <returns></returns>
        public static UserSurveyTask ReviewSurvey(SurveyResponse surveyResponse, Person reviewer, SurveyStatusEnum entryState, decimal dueInDays, bool allowComments, string taskName)
        {
            if (reviewer == null)
            {
                throw new ArgumentException("reviewer");
            }

            var task = Entity.Create <UserSurveyTask>();

            task.AssignedToUser = reviewer;
            task.UserSurveyTaskSurveyResponse  = surveyResponse;
            task.UserSurveyTaskAllowComments   = allowComments;
            task.UserSurveyTaskForReview       = true;
            task.UserSurveyTaskAllowTargetEdit = false;

            if (dueInDays > 0)
            {
                task.UserTaskDueOn = DateTime.UtcNow.AddDays(Decimal.ToDouble(dueInDays));
            }

            // use the task name or fall back to the survey name. (Note we always assume the survey exits.
            if (!String.IsNullOrWhiteSpace(taskName))
            {
                task.Name = taskName;
            }
            else
            {
                if (surveyResponse.CampaignForResults.SurveyForCampaign == null)
                {
                    throw new ArgumentException("Unable to find a survey to name the task");
                }

                task.Name = surveyResponse.CampaignForResults.SurveyForCampaign.Name;
            }

            if (task.Name == null)
            {
                throw new ArgumentException("Expected to have a task name or the name of a survey");
            }

            if (entryState != null)
            {
                var writableResult = surveyResponse.AsWritable <SurveyResponse>();
                writableResult.SurveyStatus = entryState;
                writableResult.Save();
            }

            return(task);
        }