code: @SuppressWarnings({ "rawtypes", "unchecked" })
      // The alternative would be to change the TopologolyLayerCallback.send() to take List<? extends Command>
      private void execute(final ListCommand command) {
          getMetaData(command);
  
          final Queue<ListCommand> log = metaData.getUnapprovedCommands();
          if (log.isEmpty()) {
              updateVersion(command);
              executeCommand(command);
          } else if (log.peek().getListVersionChange().equals(command.getListVersionChange())) {
              updateVersion(command);
              log.remove();
          } else {
              // repair indices
              List<? extends ListCommand> repairedCommands = indexRepairer.repairCommands(
                      metaData.getUnapprovedCommands(), command);
  
              // repair versions if local commands are left after repairing indices.
              versionRepairer.repairLocalCommandsVersion(metaData.getUnapprovedCommands(), command);
              repairedCommands = versionRepairer.repairRemoteCommandVersion(repairedCommands,
                      metaData.getUnapprovedCommandsAsList());
              // re-send repaired local changes
              topologyLayerCallback.sendCommands((List) metaData.getUnapprovedCommandsAsList());
  
              // execute repaired commands
              for (final ListCommand repaired : repairedCommands) {
                  executeCommand(repaired);
              }
              updateVersion(command);
          }
      }
docs: Executes a remotely received command, repairs it when necessary and resends repaired versions of local commands
  that where obsoleted by the received command.
  
  @param command
  The command to execute.