Improve error message when document already exists
@occurence is optional for instance type
Add unit test for instance type