Is there a better way to do this?

```
    var duplicate = false;
    for (var i = 0; i < acceptedFiles.length; i++) {
        for (var j = 0; j < attachments.attachments.length; j++) {
            if (attachments.attachments[j].name === acceptedFiles[i].name) {
                duplicate = true;
            }
        }
    }

```