To avoid capital gains you could do a 1031 Exchange. However, it is not always desirable to do a 1031 exchange, If the gain is small it isnâ€™t worthwhile to exchange because there are costs to exchange, and the basis of the Relinquished Property which is less than the purchase price is carried over thus
reducing depreciable basis in the Replacement Property â€“ a gain of less than $25,000 -$50,000 is usually the threshold. I hope this helps. If you need more info let me know, I am also an accounting major.