ProjectFileEvent Write to File Method

def next_id(self, subfolder):
        """
        ProjectFileEvent Write to File Method
        """
        evt_sim_folders = self.events.filter(
                        ProjectFileEvent.subfolder
                            .like("{0}_%".format(subfolder))
                    )
        max_id = 0
        num_search = re.compile(r'{0}_(\d+)'.format(subfolder), re.IGNORECASE)
        for prj_event in evt_sim_folders:
            found_num = num_search.findall(prj_event.subfolder)
            if found_num is not None:
                max_id = max(max_id, int(found_num[0]))
        return max_id + 1