Check for duplicates before saving them on database

@russian-dima as I told you, I did the corrections needed, so your code could work, but I got the same results. To follow the logical console logs, I have to be able to inspect it, which is not possible since the same error is shown when I try.