Working implementation of acts as trees gem