/// <summary>
        /// Define the task item via setting taskDelegateState value.
        /// </summary>
        /// <param name="subject">The subject of the task.</param>
        /// <param name="taskDelegateState">DelegationState element value of the task.</param>
        /// <param name="isSetting">The flag to indicate whether the taskDelegateState is setting or not, true means setting.</param>
        /// <returns>The task object.</returns>
        public static TaskType DefineTaskItem(string subject, TaskDelegateStateType taskDelegateState, bool isSetting)
        {
            TaskType taskNew = DefineTaskItem(subject, null);

            if (isSetting)
            {
                taskNew.DelegationStateSpecified = true;
                taskNew.DelegationState          = taskDelegateState;
            }

            return(taskNew);
        }
        /// <summary>
        /// A forgiving method to return the extended prop value if it exists
        /// </summary>
        /// <param name="state">OUT state</param>
        /// <returns>True if it exists, false if not</returns>
        /// 
        private bool TryGetCorrectedDelegateState(out TaskDelegateStateType state)
        {
            state = TaskDelegateStateType.NoMatch;

            if ((this.ExtendedProperty == null) || (this.ExtendedProperty.Length == 0))
            {
                return false;
            }
            foreach (ExtendedPropertyType prop in this.ExtendedProperty)
            {
                if ((prop.ExtendedFieldURI.PropertyId == CorrectedDelegationStatePath.PropertyId) &&
                    (prop.ExtendedFieldURI.PropertySetId == CorrectedDelegationStatePath.PropertySetId) &&
                    (prop.ExtendedFieldURI.PropertyType == CorrectedDelegationStatePath.PropertyType))
                {
                    int intValue = Int32.Parse((string)prop.Item);
                    state = (TaskDelegateStateType)intValue;
                    return true;
                }
            }
            return false;
        }
        /// <summary>
        /// Define the task item via setting taskDelegateState value.
        /// </summary>
        /// <param name="subject">The subject of the task.</param>
        /// <param name="taskDelegateState">DelegationState element value of the task.</param>
        /// <param name="isSetting">The flag to indicate whether the taskDelegateState is setting or not, true means setting.</param>
        /// <returns>The task object.</returns>
        public static TaskType DefineTaskItem(string subject, TaskDelegateStateType taskDelegateState, bool isSetting)
        {
            TaskType taskNew = DefineTaskItem(subject, null);
            if (isSetting)
            {
                taskNew.DelegationStateSpecified = true;
                taskNew.DelegationState = taskDelegateState;
            }

            return taskNew;
        }