/**
   * rest endpoint to insert new contact to address book returns 201 Created response if
   * successfully created and returns 409 conflict if Name and Last Name already existing in contact
   * list
   */
  @POST
  @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
  @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
  @Path("/contact/{name}")
  public Response add(@PathParam("name") String name, Contact contact) {
    AddressBookResponse addressBookResponse = new AddressBookResponse();

    contact.setName(name);
    if (processor.add(contact)) {
      addressBookResponse.setCode(Status.CREATED);
      addressBookResponse.setMessage("Success");
    } else {
      addressBookResponse.setCode(Status.CONFLICT);
      addressBookResponse.setMessage(
          "contact for " + contact.getName() + " " + contact.getlName() + " already exists");
    }
    return Response.ok().entity(addressBookResponse).build();
  }
  /**
   * rest endpoint to update exisitng contact to address book returns 200 response if successfully
   * updated and returns 404 notfound if Name and Last Name does not existing in contact list
   */
  @PUT
  @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
  @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
  @Path("/contact/{name}")
  public Response update(@PathParam("name") String name, Contact contact) {
    contact.setName(name);
    AddressBookResponse addressBookResponse = new AddressBookResponse();
    if (processor.update(contact)) {
      addressBookResponse.setCode(Status.OK);
      addressBookResponse.setMessage("Success");
      addressBookResponse.setMessage("Entery got successfully created");
    } else {
      addressBookResponse.setCode(Status.NOT_FOUND);
      addressBookResponse.setMessage(
          "contact for " + contact.getName() + " " + contact.getlName() + " does not exist");
    }

    return Response.ok().entity(addressBookResponse).build();
  }