Could one ever construct a Credential object with a null id? Should this be changed to `return credential.getId() != null`?