def build(self, builder):
        """Build XML by appending to builder"""
        params = dict(
            OID=self.oid, Name=self.name, Repeating=bool_to_yes_no(self.repeating)
        )

        if self.order_number is not None:
            params["mdsol:OrderNumber"] = str(self.order_number)

        if self.active is not None:
            params["mdsol:Active"] = bool_to_yes_no(self.active)

        params["mdsol:Template"] = bool_to_yes_no(self.template)
        params["mdsol:SignatureRequired"] = bool_to_yes_no(self.signature_required)
        params["mdsol:LogDirection"] = self.log_direction
        params["mdsol:DoubleDataEntry"] = self.double_data_entry
        params["mdsol:ConfirmationStyle"] = self.confirmation_style

        if self.link_study_event_oid:
            params["mdsol:LinkStudyEventOID"] = self.link_study_event_oid

        if self.link_form_oid:
            params["mdsol:LinkFormOID"] = self.link_form_oid

        builder.start("FormDef", params)
        for itemgroup_ref in self.itemgroup_refs:
            itemgroup_ref.build(builder)

        for helptext in self.helptexts:
            helptext.build(builder)

        for view_restriction in self.view_restrictions:
            view_restriction.build(builder)

        for entry_restriction in self.entry_restrictions:
            entry_restriction.build(builder)

        for alias in self.aliases:
            alias.build(builder)

        builder.end("FormDef")