initial working and saving to db