@SuppressWarnings("unchecked")
  @Override
  public Set<Person> getTopAncestors() {
    Set<Person> topAncestors = new HashSet<Person>();
    // Find all the parents
    // If a person is in the childrenmap as a key,
    // then they are registered as a parent to somebody
    em.getTransaction().begin();
    TypedQuery q = em.createQuery("select p.parents from Birth p", Person.class);
    List<Person> people = (List<Person>) q.getResultList();
    em.getTransaction().commit();

    for (Person person : people) {
      // If a person doesn't have a birth record,
      // then there's no record of a parent
      System.out.println("Found " + person);
      Birth birthRecord = findBirthRecord(person);
      if (birthRecord == null || birthRecord.getParents().isEmpty()) {
        System.out.println("Adding " + person + " to top ancestors list");
        topAncestors.add(person);
      }
    }

    return topAncestors;
  }
 @Override
 public void updateBirth(Birth b) {
   em.getTransaction().begin();
   Birth target = em.find(Birth.class, b.getId());
   target.setCountry(b.getCountry());
   target.setEventDate(b.getEventDate());
   target.setPerson(b.getPerson());
   target.setState_province(b.getState_province());
   target.setTown(b.getTown());
   target.setParents(b.getParents());
   em.merge(target);
   em.getTransaction().commit();
 }