@RequestMapping(value = "/person/{personId}", method = RequestMethod.POST)
  @ResponseBody
  public Person updatePerson(
      @PathVariable int personId,
      @RequestParam(value = "firstname", required = true) String firstname,
      @RequestParam(value = "lastname", required = true) String lastname,
      @RequestParam(value = "email", required = true) String email,
      @RequestParam(value = "description", required = false) String description,
      @RequestParam(value = "street", required = false) String street,
      @RequestParam(value = "city", required = false) String city,
      @RequestParam(value = "state", required = false) String state,
      @RequestParam(value = "zip", required = false) String zip,
      @RequestParam(value = "orgId", required = false) Integer orgId) {

    if (firstname == "" || lastname == "" || email == "") {
      throw new InvalidParameterException();
    }

    Person person = new Person(firstname, lastname, email);
    person.setId(personId);
    person.setDescription(description);
    Address address = new Address(street, city, state, zip);
    person.setAddress(address);
    if (orgId != null) {
      Organization org = new Organization();
      org.setId(orgId);
      person.setOrg(org);
    }

    personService.update(person);

    return person;
  }
 @RequestMapping(value = "/person/{personId}", method = RequestMethod.DELETE)
 @ResponseBody
 public Person deletePerson(@PathVariable int personId) {
   Person person = new Person();
   person.setId(personId);
   personService.delete(person);
   return person;
 }
  @RequestMapping(
      value = "/person/{id}",
      method = RequestMethod.GET,
      produces = {"application/xml", "application/json"})
  @ResponseBody
  public Person getPerson(@PathVariable int id) {

    Person person = personService.findByPersonId(id);
    if (person == null) {
      throw new ResourceNotFoundException();
    }

    return person;
  }
  @RequestMapping(value = "/person/{id}", method = RequestMethod.GET)
  public String getPerson(@PathVariable int id, Model model) {

    Person person = personService.findByPersonId(id);
    if (person == null) {
      throw new ResourceNotFoundException();
    }
    model.addAttribute("id", person.getId());
    model.addAttribute("firstname", person.getFirstname());
    model.addAttribute("lastname", person.getLastname());
    model.addAttribute("email", person.getEmail());
    model.addAttribute("description", person.getDescription());
    model.addAttribute("address", person.getAddress());
    model.addAttribute("organization", person.getOrg());
    return "person";
  }