Update method for the database