merged Entity and ClosureTable functionality
switched some method position in the file