avoid begin block in save
make index and type configurable.