@Override
  public void addAdoptedParent(Person child, Person parent) {
    em.getTransaction().begin();
    TypedQuery<Adoption> q =
        em.createQuery("select b from Adoption b where b.person.id = :idParam", Adoption.class);
    q.setParameter("idParam", child.getId());

    List<Adoption> results = (List<Adoption>) q.getResultList();
    Adoption a = (results != null && results.size() > 0) ? results.get(0) : null;
    if (a != null) {
      a.addParent(parent);
      em.merge(a);
    }
    em.getTransaction().commit();
  }