diff --git a/briar-core/src/net/sf/briar/db/DatabaseComponentImpl.java b/briar-core/src/net/sf/briar/db/DatabaseComponentImpl.java
index ba7049d256f98637338dcd9150eeb889dfdc66ba..99dc9c162a9729ac60e398915b627825fb8f4228 100644
--- a/briar-core/src/net/sf/briar/db/DatabaseComponentImpl.java
+++ b/briar-core/src/net/sf/briar/db/DatabaseComponentImpl.java
@@ -406,6 +406,28 @@ DatabaseCleaner.Callback {
 		if(added) callListeners(new PrivateMessageAddedEvent(c, false));
 	}
 
+	/**
+	 * If the given message is already in the database, returns false.
+	 * Otherwise stores the message and marks it as new or seen with respect to
+	 * the given contact, depending on whether the message is outgoing or
+	 * incoming, respectively.
+	 * <p>
+	 * Locking: message write.
+	 */
+	private boolean storePrivateMessage(T txn, Message m, ContactId c,
+			boolean incoming) throws DbException {
+		if(m.getGroup() != null) throw new IllegalArgumentException();
+		if(m.getAuthor() != null) throw new IllegalArgumentException();
+		if(!db.addPrivateMessage(txn, m, c)) return false;
+		if(!incoming) db.setReadFlag(txn, m.getId(), true);
+		db.addStatus(txn, c, m.getId(), incoming);
+		// Count the bytes stored
+		synchronized(spaceLock) {
+			bytesStoredSinceLastCheck += m.getSerialised().length;
+		}
+		return true;
+	}
+
 	public void addSecrets(Collection<TemporarySecret> secrets)
 			throws DbException {
 		contactLock.readLock().lock();
@@ -466,28 +488,6 @@ DatabaseCleaner.Callback {
 		return added;
 	}
 
-	/**
-	 * If the given message is already in the database, returns false.
-	 * Otherwise stores the message and marks it as new or seen with respect to
-	 * the given contact, depending on whether the message is outgoing or
-	 * incoming, respectively.
-	 * <p>
-	 * Locking: message write.
-	 */
-	private boolean storePrivateMessage(T txn, Message m, ContactId c,
-			boolean incoming) throws DbException {
-		if(m.getGroup() != null) throw new IllegalArgumentException();
-		if(m.getAuthor() != null) throw new IllegalArgumentException();
-		if(!db.addPrivateMessage(txn, m, c)) return false;
-		if(!incoming) db.setReadFlag(txn, m.getId(), true);
-		db.addStatus(txn, c, m.getId(), incoming);
-		// Count the bytes stored
-		synchronized(spaceLock) {
-			bytesStoredSinceLastCheck += m.getSerialised().length;
-		}
-		return true;
-	}
-
 	public Ack generateAck(ContactId c, int maxMessages) throws DbException {
 		Collection<MessageId> acked;
 		contactLock.readLock().lock();