Moved document insertion to sepcific type.