anchor.diff:          // reply with the Empty() message
           replyTo.send(Empty());
           break;
  +      case Command.create_sign:
  +        // assign an id and save the sign.
  +        var sign = data;
  +        sign.id = nextSignId++;
  +        signs[sign.id] = sign;
  +        // reply with the new Sign.
  +        replyTo.send(sign);
  +        break;
  +      case Command.list_signs:
  +        // reply with a list of all signs.
  +        replyTo.send(signs.values.toList());
  +        break;
  +      case Command.get_sign:
  +        // lookup the sign.
  +        var sign = signs[data.id];
  +        // reply with the requested sign or null.
  +        replyTo.send(sign);
  +        break;
  +      case Command.delete_sign:
  +        // delete the sign.
  +        signs.remove(data.id);
  +        if (signs.isEmpty) {
  +          nextSignId = 1;
  +        }
  +        // reply with the Empty() message
  +        replyTo.send(Empty());
  +        break;
  +      case Command.set_sign_id_for_kiosk_ids:
  +        var kioskIds = data[0];
  +        var signId = data[1];
  +        if (kioskIds.isEmpty) {
  +          for (var kioskID = 1; kioskID < nextKioskId; kioskID++) {
  +            signIdsForKioskIds[kioskID] = signId;
  +          }
  +        } else {
  +          for (var kioskId in kioskIds) {
  +            signIdsForKioskIds[kioskId] = signId;
  +          }
  +        }
  +        print('$signIdsForKioskIds');
  +        // reply with the Empty() message
  +        replyTo.send(Empty());
  +        break;
  +      case Command.get_sign_id_for_kiosk_id:
  +        var reply = GetSignIdResponse();
  +		var signId = signIdsForKioskIds[data.kioskId];
  +        if (signId != null) {
  +			reply.signId = signId;		
  +		}
  +        replyTo.send(reply);
  +        break;
  +      case Command.get_sign_ids_for_kiosk_id:
  +        break;
         default:
           replyTo.send(data);
       }
  
positive.code:   // initialize in-memory data store
    var kiosks = <int, Kiosk>{};
    var signs = <int, Sign>{};
    var nextKioskId = 1;
    var nextSignId = 1;
  
  
negative.code:   }
  
    createSign(call, request) async {
      // FIXME: This should be a direct return (no "then"),
      // but sendReceive() returns Future<dynamic> and we need FutureOr<Sign>.
      return sendReceive(dataManagerSendPort, Command.create_sign, request)
          .then((msg) {
        return msg;
      });
    }
  
    listSigns(call, request) async {
      return sendReceive(dataManagerSendPort, Command.list_signs, request)
          .then((msg) {
        return ListSignsResponse()..signs.addAll(msg);
      });
    }
  
    getSign(call, request) async {
      // FIXME: This should be a direct return.
      return sendReceive(dataManagerSendPort, Command.get_sign, request)
          .then((msg) {
        return msg;
      });
    }
  
    deleteSign(call, request) async {
      // FIXME: This should be a direct return.
      return sendReceive(dataManagerSendPort, Command.delete_sign, request)
          .then((msg) {
        return msg;
      });
    }
  
    setSignIdForKioskIds(call, request) async {
      // It would be better to pass the request directly to the isolate,
      // but we can't because of this: https://github.com/dart-lang/protobuf/issues/167
      return sendReceive(dataManagerSendPort, Command.set_sign_id_for_kiosk_ids,
          [request.kioskIds, request.signId]).then((msg) {
        return Empty();
      });
    }
  
    getSignIdForKioskId(call, request) async {
      return sendReceive(
              dataManagerSendPort, Command.get_sign_id_for_kiosk_id, request)
          .then((msg) {
        return msg;
      });
    }
  
    getSignIdsForKioskId(call, request) async* {
      var response = new ReceivePort();
      dataManagerSendPort
          .send([Command.get_sign_ids_for_kiosk_id, request, response.sendPort]);
      await for (var value in response) {
        print('$value');
        yield GetSignIdResponse();
      }
    }
  }
  
  