Extracted a shared method from the both save methods.