Using set to not include repeated events.
The use of a list(set) is due to the JSON serializable problem.

TODO: avoid replications in insert function