How do I speed up checking of unique identifier to prevent duplicate record saving/error