def _SaveFirstConnection(client_id, computer):
  """Function to save first connection of a given client.

  Args:
    client_id: dict client id.
    computer: models.Computer entity.
  """
  e = models.FirstClientConnection(key_name=client_id['uuid'])
  e.computer = computer
  e.owner = client_id['owner']
  e.hostname = client_id['hostname']
  e.office = client_id['office']
  e.site = client_id['site']
  e.put()

  # Set older computers with the same serial number as inactive.
  if computer.serial not in DUPE_SERIAL_NUMBER_EXCEPTIONS:
    for dupe in models.Computer.AllActive().filter('serial =', computer.serial):
      # skip over the new client.
      if dupe.uuid == computer.uuid:
        continue
      # if the dupe is clearly older, mark as inactive.
      if dupe.preflight_datetime < computer.preflight_datetime:
        dupe.active = False
        dupe.put(update_active=False)
dataset/ETHPy150Open google/simian/src/simian/mac/munki/common.py/_SaveFirstConnection/original