move repl logic to replication manager