move injectPrimaryKey to a seperate method