Inheritance: IMoreOptionsHavingBuilder
        private static string CreateTriggerBody(string buildConfigId, int? agentId, List<Property> properties = null, MoreOptionsHavingBuilder moreOptions = null)
        {
            var bodyBuilder = new StringBuilder();

            if (moreOptions != null &&
                moreOptions.TriggeringOptions.Personal == true)
            {
                bodyBuilder.Append(@"<build personal=""true"">").AppendLine();
            }
            else
            {
                bodyBuilder.Append(@"<build>").AppendLine();
            }

            bodyBuilder.AppendFormat(@"<buildType id=""{0}""/>", buildConfigId).AppendLine();

            if (agentId.HasValue)
            {
                bodyBuilder.AppendFormat(@"<agent id=""{0}""/>", agentId).AppendLine();
            }

            if (moreOptions != null &&
                moreOptions.GetComment() != null)
            {
                var encodedName = SecurityElement.Escape(moreOptions.GetComment());
                bodyBuilder.AppendFormat(@"<comment><text>{0}</text></comment>", encodedName).AppendLine();
            }

            if (moreOptions != null &&
                (moreOptions.TriggeringOptions.CleanSources == true ||
                 moreOptions.TriggeringOptions.QueueAtTop == true ||
                 moreOptions.TriggeringOptions.RebuildAllDependencies == true))
            {
                bodyBuilder.Append(@"<triggeringOptions ");
                if (moreOptions.TriggeringOptions.CleanSources == true)
                    bodyBuilder.Append(@"cleanSources=""true"" ");
                if (moreOptions.TriggeringOptions.RebuildAllDependencies == true)
                    bodyBuilder.Append(@"rebuildAllDependencies=""true"" ");
                if (moreOptions.TriggeringOptions.QueueAtTop == true)
                    bodyBuilder.Append(@"queueAtTop=""true"" ");
                bodyBuilder.Append(@"/>").AppendLine();
            }

            if (properties != null && properties.Any())
            {
                bodyBuilder.Append(@"<properties>").AppendLine();

                foreach (var property in properties)
                {
                    bodyBuilder.AppendFormat(@"<property name=""{0}"" value=""{1}""", property.Name, property.Value);
                    if (property.Type != null && !string.IsNullOrEmpty(property.Type.RawValue))
                    {
                        bodyBuilder.Append(">").AppendLine();
                        bodyBuilder.AppendFormat(@"<type rawValue=""{0}""/>", property.Type.RawValue).AppendLine();
                        bodyBuilder.Append("</property>").AppendLine();
                    }
                    else
                    {
                        bodyBuilder.Append("/>").AppendLine();
                    }
                }

                bodyBuilder.Append(@"</properties>").AppendLine();
            }

            bodyBuilder.Append("</build>").AppendLine();

            return bodyBuilder.ToString();
        }
 private static MoreOptionsHavingBuilder GetMoreOptions(Action<IMoreOptionsHavingBuilder> moreOptionsAction)
 {
     var moreOptions = new MoreOptionsHavingBuilder();
     if (moreOptionsAction == null)
     {
         return moreOptions;
     }
     moreOptionsAction(moreOptions);
     return moreOptions;
 }