anchor.diff:                      {ok}
               end;
           {error, {unknown_rsc, _}} ->
  -            %% new resource
  -            Props1 = [{name, Name}, {group_id, m_group:name_to_id_check(admins, Context)}, {category_id, CatId},
  -                      {installed_by, Module}] ++ Props,
  -            Props2 = case proplists:get_value(is_published, Props1) of
  -                         undefined ->
  -                             [{is_published, true} | Props1];
  -                         _ -> Props1
  -                     end,
  -            ?DEBUG("New resource"),
  -            ?DEBUG(Props2),
  -            m_rsc:insert(Props2, Context)
  +            %% new resource, or old resource
  +
  +            %% Check if name was previously inserted.
  +            ManagedNames = case m_config:get(Module, datamodel, Context) of
  +                               undefined ->
  +                                   [];
  +                               Cfg ->
  +                                   case proplists:get_value(managed_resources, Cfg) of
  +                                       undefined ->
  +                                           [];
  +                                       N -> N
  +                                   end
  +                           end,
  +
  +            {Result, NewNames} = case lists:member(Name, ManagedNames) of
  +                                     false ->
  +                                         Props1 = [{name, Name}, {group_id, m_group:name_to_id_check(admins, Context)}, {category_id, CatId},
  +                                                   {installed_by, Module}, {managed_props, Props}] ++ Props,
  +                                         Props2 = case proplists:get_value(is_published, Props1) of
  +                                                      undefined ->
  +                                                          [{is_published, true} | Props1];
  +                                                      _ -> Props1
  +                                                  end,
  +                                         ?DEBUG("New resource"),
  +                                         ?DEBUG(Props2),
  +                                         {m_rsc:insert(Props2, Context), [Name | ManagedNames ]};
  +                                     true ->
  +                                         ?DEBUG("resource was deleted."),
  +                                         {{ok}, ManagedNames}
  +                                 end,
  +            m_config:set_prop(Module, datamodel, managed_resources, NewNames, Context),
  +            Result
       end.
   
   
  
positive.code:                 Module ->
                      %% Resource exists and has been installed by us.
                      %% FIXME Check if it needs updating!
                      m_rsc:update(Id, Props, Context),
                      {ok, Id};
                  _ ->
                      %% Resource exists but is not installed by us!
  
negative.code:     F(Id, false, ObjectId),
  
      manage_predicate_validfor(Id, Rest, Context).
  
  
  
  map_props(Props, Context) ->
  