Add backend and UI for assigning referrals to trees