Fixed inserting with duplicate parents.
Added attachment functionality