/**
  * Add a new state.
  *
  * @param State $state The new state.
  *
  * @return void
  */
 public function add(State $state)
 {
     // state is immutable. only store new states.
     if ($state->getStateId()) {
         return;
     }
     $model = $this->convertStateToModel($state);
     $model->save();
     // dynamically add state id.
     $reflector = new \ReflectionObject($state);
     $property = $reflector->getProperty('stateId');
     $property->setAccessible(true);
     $property->setValue($state, $model->id);
 }