add wrapper for adding documents to call optimize automagically