@Action("Update")
 public void update(
     ObjectCache objectCache,
     ValuesProvider provider,
     HttpServletResponse response,
     ModelViewRegister viewFactory)
     throws IOException {
   PersonModel person =
       objectCache.retrieveByIdentity(
           PersonModel.class, provider.getIdentity(), ObjectState.Pending, ObjectState.Active);
   if (person == null) {
     new JsonView(Collections.singletonMap("error", "Person cannot be found"))
         .renderTo(new EmptyContext(), response, provider.getApplicationRoot());
   } else if (provider.getBoolean("activate", Boolean.FALSE).equals(Boolean.TRUE)) {
     person.activate();
     objectCache.save(person);
     new JsonView(Collections.singletonMap("identity", person.getIdentity()))
         .renderTo(new EmptyContext(), response, provider.getApplicationRoot());
   } else {
     new JsonView(Collections.singletonMap("error", "Person not activated"))
         .renderTo(new EmptyContext(), response, provider.getApplicationRoot());
   }
 }