         self.unit = unit
 
         super.init(dailyItems: dailyItems, timeZone: timeZone)
+    }
+
+    public required convenience init?(rawValue: RawValue) {
+        guard let
+            rawUnit = rawValue["unit"] as? String,
+            timeZoneName = rawValue["timeZone"] as? String,
+            rawItems = rawValue["items"] as? [RepeatingScheduleValue.RawValue] else
+        {
+            return nil
+        }
+
+        self.init(unit: HKUnit(fromString: rawUnit), dailyItems: rawItems.flatMap { RepeatingScheduleValue(rawValue: $0) }, timeZone: NSTimeZone(name: timeZoneName))
     }
 
     public func at(time: NSDate) -> HKQuantity {

    return lhs.startDate == rhs.startDate && lhs.value == rhs.value
}


public class DailyValueSchedule {
    private let referenceTimeInterval: NSTimeInterval
    private let repeatInterval = NSTimeInterval(hours: 24)


        }

        referenceTimeInterval = firstItem.startTime
    }

    public required convenience init?(rawValue: RawValue) {
        guard let
            timeZoneName = rawValue["timeZone"] as? String,
            rawItems = rawValue["items"] as? [RepeatingScheduleValue.RawValue] else
        {
            return nil
        }

        self.init(dailyItems: rawItems.flatMap { RepeatingScheduleValue(rawValue: $0) }, timeZone: NSTimeZone(name: timeZoneName))
    }

    public var rawValue: RawValue {
        return [
            "timeZone": timeZone.name,
            "items": items.map { $0.rawValue }
        ]
    }

    private var maxTimeInterval: NSTimeInterval {
