added methods save and insert in java