commit factory method pattern