Serialize fit results

This isn't ready to be fully pulled in yet, but it at least partially implements what we were talking about for serialisation: two basic classes that allow you to store the necessary information for fitting results.