|  | @@ 445-456 (lines=12) @@ | 
                                                            
                                    | 442 |  |      * @param   Model   $model | 
                                                            
                                    | 443 |  |      * @return  Model | 
                                                            
                                    | 444 |  |      */ | 
                                                            
                                    | 445 |  |     private function doCommitCreate(Model $model) | 
                                                            
                                    | 446 |  |     { | 
                                                            
                                    | 447 |  |         $this->dispatchLifecycleEvent(Events::preCreate, $model); | 
                                                            
                                    | 448 |  |  | 
                                                            
                                    | 449 |  |         $this->getPersisterFor($model->getType())->create($model); | 
                                                            
                                    | 450 |  |         $model->getState()->setNew(false); | 
                                                            
                                    | 451 |  |         // Should the model always reload? Or should the commit be assumed correct and just clear the new/dirty state? | 
                                                            
                                    | 452 |  |         $model->reload(); | 
                                                            
                                    | 453 |  |  | 
                                                            
                                    | 454 |  |         $this->dispatchLifecycleEvent(Events::postCreate, $model); | 
                                                            
                                    | 455 |  |         return $model; | 
                                                            
                                    | 456 |  |     } | 
                                                            
                                    | 457 |  |  | 
                                                            
                                    | 458 |  |     /** | 
                                                            
                                    | 459 |  |      * Performs a Model delete commit and persists to the database. | 
                                                                                
                                |  | @@ 464-473 (lines=10) @@ | 
                                                            
                                    | 461 |  |      * @param   Model   $model | 
                                                            
                                    | 462 |  |      * @return  Model | 
                                                            
                                    | 463 |  |      */ | 
                                                            
                                    | 464 |  |     private function doCommitDelete(Model $model) | 
                                                            
                                    | 465 |  |     { | 
                                                            
                                    | 466 |  |         $this->dispatchLifecycleEvent(Events::preDelete, $model); | 
                                                            
                                    | 467 |  |  | 
                                                            
                                    | 468 |  |         $this->getPersisterFor($model->getType())->delete($model); | 
                                                            
                                    | 469 |  |         $model->getState()->setDeleted(); | 
                                                            
                                    | 470 |  |  | 
                                                            
                                    | 471 |  |         $this->dispatchLifecycleEvent(Events::postDelete, $model); | 
                                                            
                                    | 472 |  |         return $model; | 
                                                            
                                    | 473 |  |     } | 
                                                            
                                    | 474 |  |  | 
                                                            
                                    | 475 |  |     /** | 
                                                            
                                    | 476 |  |      * Performs a Model update commit and persists to the database. | 
                                                                                
                                |  | @@ 481-491 (lines=11) @@ | 
                                                            
                                    | 478 |  |      * @param   Model   $model | 
                                                            
                                    | 479 |  |      * @return  Model | 
                                                            
                                    | 480 |  |      */ | 
                                                            
                                    | 481 |  |     private function doCommitUpdate(Model $model) | 
                                                            
                                    | 482 |  |     { | 
                                                            
                                    | 483 |  |         $this->dispatchLifecycleEvent(Events::preUpdate, $model); | 
                                                            
                                    | 484 |  |  | 
                                                            
                                    | 485 |  |         $this->getPersisterFor($model->getType())->update($model); | 
                                                            
                                    | 486 |  |         // Should the model always reload? Or should the commit be assumed correct and just clear the new/dirty state? | 
                                                            
                                    | 487 |  |         $model->reload(); | 
                                                            
                                    | 488 |  |  | 
                                                            
                                    | 489 |  |         $this->dispatchLifecycleEvent(Events::postUpdate, $model); | 
                                                            
                                    | 490 |  |         return $model; | 
                                                            
                                    | 491 |  |     } | 
                                                            
                                    | 492 |  |  | 
                                                            
                                    | 493 |  |     /** | 
                                                            
                                    | 494 |  |      * Validates that a model type can be set to an owning metadata type. |