Save derived fix

When the derived calculation update completes and there are no changes to save, the sql query fails, so avoid that by skipping the writing to database step when there are no changes to save.