Add PrimaryKey methods and resolve compile errors