state.id set to null if new