def save(self, commit=True):
existing_record = EventStaffMember.objects.filter(<EOL>staffMember=self.cleaned_data.get('<STR_LIT>'),<EOL>event=self.cleaned_data.get('<STR_LIT>'),<EOL>category=getConstant('<STR_LIT>'),<EOL>replacedStaffMember=self.cleaned_data.get('<STR_LIT>'),<EOL>)<EOL>if existing_record.exists():<EOL><INDENT>record = existing_record.first()<EOL>for x in self.cleaned_data.get('<STR_LIT>'):<EOL><INDENT>record.occurrences.add(x)<EOL><DEDENT>record.save()<EOL>return record<EOL><DEDENT>else:<EOL><INDENT>return super(SubstituteReportingForm,self).save()<EOL><DEDENT>
If a staff member is reporting substitute teaching for a second time, then we should update
the list of occurrences for which they are a substitute on their existing EventStaffMember
record, rather than creating a new record and creating database issues.