'Compare the last saved metadata for each datatype in the repository with the new metadata
in self.metadata_dict to determine if a new repository_metadata table record is required
or if the last saved metadata record can be updated for datatypes instead.'

def new_datatypes_metadata_required(self, repository_metadata):

    if ('datatypes' in self.metadata_dict):
        current_datatypes = self.metadata_dict['datatypes']
        if repository_metadata:
            metadata = repository_metadata.metadata
            if metadata:
                if ('datatypes' in metadata):
                    ancestor_datatypes = metadata['datatypes']
                    datatype_comparison = self.compare_datatypes(ancestor_datatypes, current_datatypes)
                    if (datatype_comparison == self.NOT_EQUAL_AND_NOT_SUBSET):
                        return True
                    else:
                        return False
                else:
                    return False
            else:
                return False
        else:
            return True
    return False
