Create accessor for primary_key if it is not id for object serializer

- get primary key from model class for model serializer.