Write some pseudo code for buying entities