added check for existing documents
check for update or create on put