Refactored to reuse method
Merge pull request #9734 from choudhuryanupam/master

Method #primary_key? is not reused