topic write functionality