/** {@inheritDoc} */
  @POST
  @Path("/picture/{personId}")
  @Consumes("image/jpeg")
  public Response uploadImage(@PathParam("personId") String personId, InputStream inputStream)
      throws IOException {
    String destinationPath = PICTURE_BASE_PATH + personId + ".jpg";

    try {
      int read;
      byte[] bytes = new byte[1024];

      new File(destinationPath).delete();

      FileOutputStream out = new FileOutputStream(destinationPath, false);
      while ((read = inputStream.read(bytes)) > 0) {
        out.write(bytes, 0, read);
      }
      inputStream.close();
      out.flush();
      out.close();
      cardManager.updateImage(personId);
    } catch (IOException e) {
      return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e).build();
    }
    return Response.ok().build();
  }