@Override
    public RoleSchool addRole(String json, int id) throws NotFoundException {
        JSONObject jObj = new JSONObject(json);
        String roleName = jObj.getString("roleName");
        RoleSchool role = null;
        if (roleName.equalsIgnoreCase("Teacher")) {
            role = new Teacher(jObj.getString("degree"));
        } else if (roleName.equalsIgnoreCase("Student")) {
            role = new Student(jObj.getString("semester"));
        } else if (roleName.equalsIgnoreCase("AssistentTeacher")) {
            role = new AssistentTeacher();
        }
        role.setRoleName(roleName);
        Person p = em.find(Person.class, id);
        if (p == null) {
            throw new NotFoundException("No person exists for the given id");
        }
        if (role == null) {
            throw new NotFoundException("No role exist for the given rolename");
        }
        em.getTransaction().begin();
        try {
            em.persist(role);
            p.addRole(role);
            em.getTransaction().commit();
        } catch (Exception e) {
            em.getTransaction().rollback();
            role = null;
        }
        return role;
    }