}
public Map<String, String> addImages(String userId, Map<String, Blob> images) {
Map<String, String> keys = new HashMap<String, String>();
for (Entry<String, Blob> entry : images.entrySet()) {
Image image = new Image();
image.setName(entry.getKey());
image.setImage(entry.getValue());
image.setUserId(userId);
model.getTransaction().begin();
model.persist(image);
model.getTransaction().commit();
keys.put(KeyFactory.keyToString(image.getId()), entry.getKey());
}
return keys;
}