fixed crazy case where foreignUniqueKey hung around after changes
used a sweet ternary operator to slim down date formatter stuff in mapper