anchor.diff:      SOA = SOA0#dns_rrdata_soa{serial = Serial + 1},
       Zone = build_zone(ZoneName, Zone0#zone.allow_notify, Zone0#zone.allow_transfer,
           Zone0#zone.allow_update, Zone0#zone.also_notify, Zone0#zone.notify_source, Zone0#zone.version,
  -        [Authority#dns_rr{data = SOA}],  Records),
  +        [Authority#dns_rr{data = SOA}],  remove_old_soa_add_new(Records, Authority#dns_rr{data = SOA})),
       %% Put zone back into cache. And send notify if needed.
  +    ok = delete_zone(ZoneName),
       case SendNotify of
           false ->
  -            put_zone(ZoneName, Zone);
  +            ok = put_zone(ZoneName, Zone);
           true ->
  -            put_zone(ZoneName, Zone),
  +            ok = put_zone(ZoneName, Zone),
               send_notify(ZoneName, Zone)
       end.
   
  
positive.code:     NotifySourceIP, Version, Records) ->
    RecordsByName = build_named_index(Records),
    Authority = lists:filter(erldns_records:match_type(?DNS_TYPE_SOA), Records),
  %%   Authorities = lists:foldl(fun(A, Acc) ->
  %%                     SOA = A#dns_rr.data,
  %%                     [{timestamp() + SOA#dns_rrdata_soa.expire, A} | Acc]
  %%                         end, [], Authorities0),
    #zone{name = Qname, allow_notify = AllowNotifyList, allow_transfer = AllowTransferList,
        allow_update = AllowUpdateList, also_notify = AlsoNotifyList, notify_source = NotifySourceIP,
        version = Version, record_count = length(Records), authority = Authority, records = Records, records_by_name = RecordsByName}.
  
negative.code:     SOA = SOA0#dns_rrdata_soa{serial = Serial + 1},
      Zone = build_zone(ZoneName, Zone0#zone.allow_notify, Zone0#zone.allow_transfer,
          Zone0#zone.allow_update, Zone0#zone.also_notify, Zone0#zone.notify_source, Zone0#zone.version,
          [Authority#dns_rr{data = SOA}],  remove_old_soa_add_new(Records, Authority#dns_rr{data = SOA})),
      %% Put zone back into cache.
      ok = delete_zone(ZoneName),
      case SendNotify of
          false ->
              ok = put_zone(ZoneName, Zone);
          true ->
              ok = put_zone(ZoneName, Zone),
              send_notify(ZoneName, Zone)
      end.
  % ----------------------------------------------------------------------------------------------------
  