Refactor the synchronize action plugin and add unit tests