String userId = fromLongToId(Long.parseLong(userID));
String itemId = fromLongToId(Long.parseLong(itemID));
if (!isUserItemInDB(userId, itemId)) {
mongoTimestamp = new Date();
BasicDBObject user = new BasicDBObject();
Object userIdObject = userIsObject ? new ObjectId(userId) : userId;
Object itemIdObject = itemIsObject ? new ObjectId(itemId) : itemId;
user.put(mongoUserID, userIdObject);
user.put(mongoItemID, itemIdObject);
user.put(mongoPreference, preferenceIsString ? preferenceValue : Double.parseDouble(preferenceValue));
user.put("created_at", mongoTimestamp);
collection.insert(user);