code: def write_to_db(self, save_json=True, save_xml=True):
          
          metadata_json = None
          metadata_xml = None
          if save_json:
              metadata_json = self.get_writable_metadata('json')
          if save_xml:
              metadata_xml = self.get_writable_metadata('xml')
          self.db_io.write_metadata_for_uri(
              self.layer_uri, metadata_json, metadata_xml)
          return metadata_json, metadata_xml
docs: Stores the metadata json and/or xml in a DB.
  
          The returned tuple can contain None.
  
          :param save_json: flag to save json
          :type save_json: bool
          :param save_xml: flag to save xml
          :type save_xml: bool
          :return: the stored metadata
          :rtype: (str, str)