Implement dirty tracking for hasMany relationships

Here's my attempt at this. There are a few things I would like some feedback on. I'll comment inline. #157