Optimize code to save the post attachment.
Merge branch 'hotfix'