public void storePerson(Person person) throws NameClashException,
            UpdatingNonexistantPersonException {
        Person foundDbPerson = null;
        int personId = person.getId();
        if (personId != -1) {
            foundDbPerson = findPersonWithId(personId);
            if (foundDbPerson == null) {
                throw new UpdatingNonexistantPersonException(
                        "A person with id "
                                + personId
                                + " was being updated but the ID doesn't exist.");
            }
        } else {
            for (Person dbPerson : persons) {
                if (person.getFirstName().equals(dbPerson.getFirstName())
                        && person.getLastName().equals(dbPerson.getLastName())) {
                    if (person.getId() != dbPerson.getId()) {
                        throw new NameClashException(
                                "Two persons with the same name is not allowed");
                    } else {
                        foundDbPerson = dbPerson;
                        break;
                    }
                }
            }
        }
        if (foundDbPerson != null) {
            persons.remove(foundDbPerson);
        }
        if (person.getId() == -1) {
            person.setId(idCount++);
        }
        try {
            Person clonedPerson = person.clone();
            persons.add(clonedPerson);
        } catch (CloneNotSupportedException e) {
            // Person doesn't throw a CloneNotSupportedException
        }
    }