def commit(self):
if self._child_consents:<EOL><INDENT>consents = []<EOL>for consent in self._child_consents:<EOL><INDENT>consent.granted = self.granted<EOL>consents.append(consent.save() or consent)<EOL><DEDENT>return ProxyDataSharingConsent.from_children(self.program_uuid, *consents)<EOL><DEDENT>consent, _ = DataSharingConsent.objects.update_or_create(<EOL>enterprise_customer=self.enterprise_customer,<EOL>username=self.username,<EOL>course_id=self.course_id,<EOL>defaults={<EOL>'<STR_LIT>': self.granted<EOL>}<EOL>)<EOL>self._exists = consent.exists<EOL>return consent<EOL>
Commit a real ``DataSharingConsent`` object to the database, mirroring current field settings.

:return: A ``DataSharingConsent`` object if validation is successful, otherwise ``None``.