Refactored getPrimaryKey in the Connection and Model classes