Fixed active record delete bug.
Added getLastInsertId function.