Set timeFrom and timeTo when create new album.
Set timeFrom/timeTo to be the earliest/latest date of all child Photos’ time and child Albums’ timeFrom/timeTo. Also update these two value for all parents of the new album.
Change Photo.time, Album.timeFrom, Album.timeTo to optional in Core Data.
Remove redundant codes for adding same relationship from both two side. Inverse Relationship is maintained by Core Data so we only need to add the relationship from either one side.