Move attachments saving to EVENT_AFTER_INSERT active record event

What steps will reproduce the problem?
1. Attach any file to the model with file uploader;
2. Click "Save"

What is the expected result?
Model is saved, attachment model is saved after and linked to the model ID.

What happens instead?
Attachment model is saved before primary model. Primary model ID can not be resolved.