hook_entity_presave() doesn't work I want to save some details before saving the node, and I tried with hook_node_presave().

function hook_node_presave(Drupal Core Entity EntityInterface $node) {
  if ($node-&gt;id() &amp;&amp; $node-&gt;moderate) {
    // Reset votes when node is updated:
    $node-&gt;score = 0;
    $node-&gt;users = '';
    $node-&gt;votes = 0;
  }
}


Then with hook_entity_presave(). 

function hook_entity_presave(Drupal Core Entity EntityInterface $entity) {
  $entity-&gt;changed = REQUEST_TIME;
}


Both hooks don't work. Why?
Your function should be named according to your module's name. If your module is called "foo", then:

function foo_node_presave(Drupal\Core\Entity\EntityInterface $node) {


Note also the use of backslashes, not spaces, to separate namespaces.