@POST
 @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
 @Path("{id}")
 public final String update(
     List<CollectionBean> collections, @PathParam("id") final long targetId) {
   Integer received = 0;
   final FormBean form = dbManager.selectFormBean(targetId);
   final List<CollectionBean> collectionList = new ArrayList<CollectionBean>(collections.size());
   for (final CollectionBean collection : collections) {
     final long currentId = collection.getId();
     if (currentId != targetId) {
       final String message =
           String.format(
               "Form reference (id=%s) for this collection is different from target Form (id=%s)",
               currentId, targetId);
       throw new IllegalStateException(message);
     }
     collectionList.add(collection);
     ++received;
   }
   form.setCollections(collectionList);
   dbManager.insertCollections(form);
   return received.toString();
 }