private Proto.ReminderState StateToProto(Reminder.State state) { var proto = new Proto.ReminderState(); foreach (var schedule in state.Entries.Values) { proto.Entries.Add(EntryToProto(schedule)); } return(proto); }
private Reminder.State StateFromProto(Proto.ReminderState proto) { var builder = ImmutableDictionary <string, Reminder.Schedule> .Empty.ToBuilder(); foreach (var protoEntry in proto.Entries) { var taskId = protoEntry.TaskId; builder[taskId] = EntryFromProto(protoEntry); } return(new Reminder.State(builder.ToImmutable())); }