Water purification and recycling using the CDI process