write to database on entity done except error table