Save function: convert to mysql