@Override
    public RoleSchool addRole(String json, Integer id) throws NotFoundException {
        Person p = gson.fromJson(getPerson(id), Person.class);
        HashMap<String, String> map = new Gson().fromJson(json, new TypeToken<HashMap<String, String>>() {
        }.getType());

        String roleName = map.get("roleName");
        RoleSchool role;

        switch (roleName) {
            case "Teacher Assistant":
                //Create role
                RoleSchool ta = new TeacherAssistant();
                ta.setPerson(p);
                role = ta;
                break;
            case "Teacher":

                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");

                String dateInString = map.get("date");
                Date date = new Date();

                try {
                    date = formatter.parse(dateInString);
                } catch (ParseException e) {
                    e.printStackTrace(System.out);
                }

                RoleSchool t = new Teacher(date, map.get("degree"));
                t.setPerson(p);
                role = t;
                break;
            case "Student":
                RoleSchool s = new Student(map.get("semester"));
                s.setPerson(p);
                role = s;
                break;
            default:
                throw new IllegalArgumentException("no such role");
        }
        //save this info
        EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceFileName);
        EntityManager em = emf.createEntityManager();
        EntityTransaction transaction = em.getTransaction();
        transaction.begin();

        try {
            em.persist(role);
            transaction.commit();
            em.getEntityManagerFactory().getCache().evictAll();
        } catch (Exception e) {
            throw new NotFoundException("Couldnt add role");
        } finally {
            em.close();
        }

        return role;

    }