def convert_groups_to_crashes(groups):
  """Convert groups to crashes (in an array of dicts) for JobRun."""
  crashes = []
  for group in groups:
    crashes.append({
        'is_new': group.is_new(),
        'count': len(group.crashes),
        'crash_type': group.main_crash.crash_type,
        'crash_state': group.main_crash.crash_state,
        'security_flag': group.main_crash.security_flag,
    })
  return crashes