def METHOD_NAME(job, mappings):
  """Clear existing mappings for a job, and replace them."""
  existing_fuzzers_query = data_types.Fuzzer.query(
      data_types.Fuzzer.jobs == job.name)
  existing_fuzzers = {fuzzer.name: fuzzer for fuzzer in existing_fuzzers_query}
  modified_fuzzers = []
  for fuzzer_name in mappings:
    fuzzer = existing_fuzzers.pop(fuzzer_name, None)
    if fuzzer:
      continue
    fuzzer = data_types.Fuzzer.query(
        data_types.Fuzzer.name == fuzzer_name).get()
    if not fuzzer:
      logs.log_error('An unknown fuzzer %s was selected for job %s.' %
                     (fuzzer_name, job.name))
      continue
    fuzzer.jobs.append(job.name)
    modified_fuzzers.append(fuzzer)
    update_mappings_for_fuzzer(fuzzer)
  # Removing the remaining values in exisiting_fuzzers as
  # they are no longer mapped.
  for fuzzer in existing_fuzzers.values():
    fuzzer.jobs.remove(job.name)
    modified_fuzzers.append(fuzzer)
    update_mappings_for_fuzzer(fuzzer)
  ndb.put_multi(modified_fuzzers)