fixing bug where multiple first time save will create multiple doc in the backend.