add extra check before storing documentStore id
Don't try to store a  query which is already present in postgres (duplicate key error in postgres log)
Don't try to store a resultSet which is already present in postgres (duplicate key error in postgres log)