simplify check if document exists