Hi Pyoma,
You can use a ‘before commit ’ event handler, for this, you can put an event handler on project and then check, if there’s a project_data with the same values, if it’s there you can associate it, and if it’s not there you an commit it.
Let me know if you have any confusion,
Hope it helps!!
**EDITED**