add Task data attribute, do not add Task attributes which are undefined