docs: def update(did):
      """Update DDO of an existing asset
      ---
      tags:
        - ddo
      consumes:
        - application/json
      parameters:
        - in: body
          name: body
          required: true
          description: DDO of the asset.
          schema:
            type: object
            required:
              - "@context"
              - created
              - id
              - publicKey
              - authentication
              - proof
              - service
            properties:
              "@context":
                description:
                example: https://w3id.org/future-method/v1
                type: string
              id:
                description: ID of the asset.
                example: did:op:123456789abcdefghi
                type: string
              created:
                description: date of ddo creation.
                example: "2016-02-08T16:02:20Z"
                type: string
              publicKey:
                    type: array
                    description: List of public keys.
                    example: [{"id": "did:op:123456789abcdefghi#keys-1"},
                              {"type": "Ed25519VerificationKey2018"},
                              {"owner": "did:op:123456789abcdefghi"},
                              {"publicKeyBase58": "H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV"}]
              authentication:
                    type: array
                    description: List of authentication mechanisms.
                    example: [{"type": "RsaSignatureAuthentication2018"},
                              {"publicKey": "did:op:123456789abcdefghi#keys-1"}]
              proof:
                    type: dictionary
                    description: Information about the creation and creator of the asset.
                    example:  {"type": "UUIDSignature",
                               "created": "2016-02-08T16:02:20Z",
                               "creator": "did:example:8uQhQMGzWxR8vw5P3UWH1ja",
                               "signatureValue": "QNB13Y7Q9...1tzjn4w=="
                              }
              service:
                    type: array
                    description: List of services.
                    example: [{"type": "Access",
                               "serviceEndpoint":
                               "http://mybrizo.org/api/v1/brizo/services/consume?pubKey=${
                               pubKey}&serviceId={serviceId}&url={url}"},
                              {"type": "Compute",
                               "serviceEndpoint":
                               "http://mybrizo.org/api/v1/brizo/services/compute?pubKey=${
                               pubKey}&serviceId={serviceId}&algo={algo}&container={container}"},
                             {
                              "type": "Metadata",
                              "serviceDefinitionId": "2",
                              "serviceEndpoint":
                              "http://myaquarius.org/api/v1/provider/assets/metadata/{did}",
                              "metadata": {
                                  "base": {
                                      "name": "UK Weather information 2011",
                                      "type": "dataset",
                                      "description": "Weather information of UK including
                                      temperature and humidity",
                                      "dateCreated": "2012-02-01T10:55:11Z",
                                      "author": "Met Office",
                                      "license": "CC-BY",
                                      "copyrightHolder": "Met Office",
                                      "compression": "zip",
                                      "workExample": "stationId,latitude,longitude,datetime,
                                      temperature,humidity/n423432fsd,51.509865,-0.118092,
                                      2011-01-01T10:55:11+00:00,7.2,68",
                                      "files": [{
                                              "contentLength": "4535431",
                                              "contentType": "text/csv",
                                              "encoding": "UTF-8",
                                              "compression": "zip",
                                              "resourceId": "access-log2018-02-13-15-17-29-18386C502CAEA932"
                                      }
                                      ],
  
                                      "encryptedFiles": "0x098213xzckasdf089723hjgdasfkjgasfv",
                                      "links": [{
                                              "name": "Sample of Asset Data",
                                              "type": "sample",
                                              "url": "https://foo.com/sample.csv"
                                          },
                                          {
                                              "name": "Data Format Definition",
                                              "type": "format",
                                              "AssetID":
                                              "4d517500da0acb0d65a716f61330969334630363ce4a6a9d39691026ac7908ea"
                                          }
                                      ],
                                      "inLanguage": "en",
                                      "tags": "weather, uk, 2011, temperature, humidity",
                                      "price": 10,
                                      "checksum":
                                      "38803b9e6f04fce3fba4b124524672592264d31847182c689095a081c9e85262"
                                  },
                                  "curation": {
                                      "rating": 0.93,
                                      "numVotes": 123,
                                      "schema": "Binary Voting"
                                  },
                                  "additionalInformation": {
                                      "updateFrecuency": "yearly",
                                      "structuredMarkup": [{
                                              "uri": "http://skos.um.es/unescothes/C01194/jsonld",
                                              "mediaType": "application/ld+json"
                                          },
                                          {
                                              "uri": "http://skos.um.es/unescothes/C01194/turtle",
                                              "mediaType": "text/turtle"
                                          }
                                      ]
                                  }
                              }
                          }]
      responses:
        200:
          description: Asset successfully updated.
        201:
          description: Asset successfully registered.
        400:
          description: One of the required attributes is missing.
        404:
          description: Invalid asset data.
        500:
          description: Error
      """
      required_attributes = ['@context', 'created', 'id', 'publicKey', 'authentication', 'proof',
                             'service']
      required_metadata_base_attributes = ['name', 'dateCreated', 'author', 'license',
                                           'price', 'encryptedFiles', 'type', 'checksum']
      required_metadata_curation_attributes = ['rating', 'numVotes']
  
      assert isinstance(request.json, dict), 'invalid payload format.'
  
      data = request.json
      if not data:
          logger.error(f'request body seems empty, expecting {required_attributes}')
          return 400
      msg, status = check_required_attributes(required_attributes, data, 'update')
      if msg:
          return msg, status
      msg, status = check_required_attributes(required_metadata_base_attributes,
                                              _get_base_metadata(data['service']), 'update')
      if msg:
          return msg, status
      msg, status = check_required_attributes(required_metadata_curation_attributes,
                                              _get_curation_metadata(data['service']), 'update')
      if msg:
          return msg, status
      msg, status = check_no_urls_in_files(_get_base_metadata(data['service']), 'register')
      if msg:
          return msg, status
      msg, status = validate_date_format(data['created'])
      if msg:
          return msg, status
  
      _record = dict()
      _record = copy.deepcopy(data)
      _record['created'] = datetime.strptime(data['created'], '%Y-%m-%dT%H:%M:%SZ')
      try:
  
          if dao.get(did) is None:
              register()
              return _sanitize_record(_record), 201
          else:
              for service in _record['service']:
                  service_id = int(service['serviceDefinitionId'])
                  if service['type'] == 'Metadata':
                      _record['service'][service_id]['metadata']['base']['datePublished'] = _get_date(
                          dao.get(did)['service'])
              dao.update(_record, did)
              return Response(_sanitize_record(_record), 200, content_type='application/json')
      except Exception as err:
          return f'Some error: {str(err)}', 500