         let sql = "INSERT OR IGNORE INTO \(TableLoginsLocal) " +
         "(\(shared)\(local)) " +
         "SELECT \(shared), NULL AS local_modified, 0 AS is_deleted, 0 AS sync_status " +
-        "FROM \(TableLoginsMirror) WHERE guid = ?"
-
-        let args: Args = [guid]
+        "FROM \(TableLoginsMirror) " +
+        (whereClause ?? "")
+
         return self.db.write(sql, withArgs: args)
     }
 

     * Clean up any metadata.
     */
    public func onRemovedAccount() -> Success {
        return succeed()
    }
}

    }

    private func cloneMirrorToOverlay(guid: GUID) -> Deferred<Result<Int>> {
        let whereClause = "WHERE guid = ?"
        let args: Args = [guid]

        return self.cloneMirrorToOverlay(whereClause: whereClause, args: args)
    }

    private func cloneMirrorToOverlay(#whereClause: String?, args: Args?) -> Deferred<Result<Int>> {
        let shared =
        "guid " +
        ", hostname" +
