Changed model extension to save attachment after save

It raise an error to try to save attachment to a unsaved model. And it
doesn’t make sense to save attachment before we are sure that the model
is saved correctly.