Update ResourceManager.php

There was error when cutting multiple resources and pasting them in a folder.

Sometimes the next_id of a resource was not updated which causes an exception (unicity constraint). So we used  ```forceFlush``` instead of ```flush```
We also replaced ```removePreviousWherePreviousIs``` and ```removeNextWhereNextIs``` methods with simpler ones, but we don't know if it really do the same... Any way those methods seemed to do the same things multiple times...