This is an helper method that will first try to find the item with the desired name using getItem(). If the item is found, it will call its setContent() method. If not, it will just create a new directive at the bottom with the given name and content.
Name of the directive to look for
New content, usually a string
Index of the directive to set, in case there are more than one directive with the same name