Fixed an error where server would 500 if foreign keys were passed in null.
Fixed yet another persistence error, related to the last.