             else if !error || error.constructor is errors.NotFound
                 # Otherwise, fan out to remote service
                 @remote.resolve userId, cb
-                # TODO: catch if remote frontend found ourselves
+                # TODO: catch if remote backend found ourselves
             else
                 cb error
 

        @operations = require('./local/operations')
        @operations.setModel model

    addFrontend: (frontend) ->
        @remote.addFrontend frontend

    resolve: (userId, cb) ->
        # First, look if already subscribed, therefore database is up to date:


class RemoteRouter
    constructor: () ->
        @backends = []
        # cache :: { userId: { queue: [Function], result: ... } }
        @cache = {}

    addBackend: (backend) ->
        @backends.push backend

    resolve: (userId, cb) ->
        backendIdx = 0
        go = () =>
            backend = @backends[backendIdx]
            unless backend
                return cb new errors.NotFound("Cannot resolve user")
            backend.resolve userId, (error, result) ->
                if error
                    backendIdx++
                    go()
                else
                    cb null, result
