public static StateChange convertProtoToStorage(
     org.ucam.srcf.assassins.domain.proto.StateChange stateChange) {
   StateChange change = constructStateChange(stateChange);
   if (stateChange.hasId()) {
     change.setId(stateChange.getId());
   }
   return change;
 }
 private static StateChange constructStateChange(
     org.ucam.srcf.assassins.domain.proto.StateChange stateChange) {
   switch (stateChange.getType()) {
     case ADD_PLAYER:
       return convertAddPlayer(stateChange.getExtension(Base.addPlayer));
     case KILL:
       return convertKill(stateChange.getExtension(Vanilla.kill));
     default:
       throw new IllegalArgumentException(
           "Unrecognised StateChange type - " + stateChange.getType());
   }
 }
 public static org.ucam.srcf.assassins.domain.proto.StateChange convertStorageToProto(
     StateChange stateChange) {
   org.ucam.srcf.assassins.domain.proto.StateChange.Builder stateChangeBuilder =
       org.ucam.srcf.assassins.domain.proto.StateChange.newBuilder();
   stateChangeBuilder.setId(stateChange.getId());
   if (stateChange instanceof Kill) {
     stateChangeBuilder.setType(org.ucam.srcf.assassins.domain.proto.StateChange.Type.KILL);
     stateChangeBuilder.setExtension(Vanilla.kill, convertKill((Kill) stateChange));
   } else if (stateChange instanceof AddPlayer) {
     stateChangeBuilder.setType(org.ucam.srcf.assassins.domain.proto.StateChange.Type.ADD_PLAYER);
     stateChangeBuilder.setExtension(Base.addPlayer, convertAddPlayer((AddPlayer) stateChange));
   }
   return stateChangeBuilder.build();
 }