}
private Record writeRecord(Record record) throws RepositoryException, InterruptedException{
record = record.cloneRecord();
Record originalRecord = record;
ResponseStatus status = ResponseStatus.UP_TO_DATE;
if (records.containsKey(record.getId())) {
originalRecord = records.get(record.getId());
record = merge(record, originalRecord);
if (!originalRecord.equals(record)) {