fixed DB instance in Model::count()
Added possibility to return existing ID upon creation if duplicate key