Merge pull request #166 from Rathil/master

Big refactoring
Merge pull request #168 from Rathil/master

add protected function generationPrimaryKey on insert
Removed the new record scenario on getPrimaryKey() since it will do that
anyway