code: public void writeResource(CmsDbContext dbc, CmsResource resource) throws CmsException {
  
          // access was granted - write the resource
          resource.setUserLastModified(dbc.currentUser().getId());
          CmsUUID projectId = ((dbc.getProjectId() == null) || dbc.getProjectId().isNullUUID())
          ? dbc.currentProject().getUuid()
          : dbc.getProjectId();
  
          getVfsDriver(dbc).writeResource(dbc, projectId, resource, UPDATE_RESOURCE_STATE);
  
          // make sure the written resource has the state correctly set
          if (resource.getState().isUnchanged()) {
              resource.setState(CmsResource.STATE_CHANGED);
          }
  
          // delete in content relations if the new type is not parseable
          if (!(OpenCms.getResourceManager().getResourceType(resource.getTypeId()) instanceof I_CmsLinkParseable)) {
              deleteRelationsWithSiblings(dbc, resource);
          }
  
          // update the cache
          m_monitor.clearResourceCache();
          Map<String, Object> data = new HashMap<String, Object>(2);
          data.put(I_CmsEventListener.KEY_RESOURCE, resource);
          data.put(I_CmsEventListener.KEY_CHANGE, new Integer(CHANGED_RESOURCE));
          OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_RESOURCE_MODIFIED, data));
      }
docs: Writes a resource to the OpenCms VFS.<p>
  
  @param dbc the current database context
  @param resource the resource to write
  
  @throws CmsException if something goes wrong