final String[] stateIds = command.getStateIds();
for (int j = 0; j < stateIds.length; j++) {
final String stateId = stateIds[j];
final State state = command.getState(stateId);
if (state instanceof PersistentState) {
final PersistentState persistentState = (PersistentState) state;
if (persistentState.shouldPersist()) {
persistentState.save(PrefUtil
.getInternalPreferenceStore(),
createPreferenceKey(command, stateId));
}
}
}