Can you provide the meta data you are using (which is being inserted as duplicate)? What is the value of each `key`? It sounds like you may be adding multiple meta records for the module, and some may have the same key, which causes a duplicate key entry error. Both the `module_id` and the `key` make up the primary key, so each `key` must be unique for the same module.