docs: def duplicate(self, contributor=None):
          """Duplicate (make a copy)."""
          duplicate = Collection.objects.get(id=self.id)
          duplicate.pk = None
          duplicate.slug = None
          duplicate.name = 'Copy of {}'.format(self.name)
          duplicate.duplicated = now()
          if contributor:
              duplicate.contributor = contributor
  
          duplicate.save(force_insert=True)
  
          assign_contributor_permissions(duplicate)
  
          # Fields to inherit from original data object.
          duplicate.created = self.created
          duplicate.save()
  
          # Duplicate collection's entities.
          entities = get_objects_for_user(contributor, 'view_entity', self.entity_set.all())  # pylint: disable=no-member
          duplicated_entities = entities.duplicate(contributor=contributor)
          duplicate.entity_set.add(*duplicated_entities)
  
          # Add duplicated data objects to collection.
          for duplicated_entity in duplicate.entity_set.all():
              duplicate.data.add(*duplicated_entity.data.all())
  
          return duplicate