Subject Firebird replication help needed

I am writing a two way server - client Firebird replication with a C# app and I am facing the following problem. I have a log table with the table name pk of the record and type of the query executet on it. For example if in the sales table there has been inserted a line with primery key of 4 there will be the table name, pk of the record and insert. My idea is if the statement is insert to take every value from the client's DB and insert it into the server's. How do I do this and how to do it so that it can work fast. Should I devide every record by tables and select all unreplicated records from that table or there is some other way. Please help me.

By the way I used the method where every query that has been executed is written in a fild in the log table, but that makes it impossible to add columns to the table, cos the query will be wrong. Please help me. I've been strugling to write a good replication for years.