DRY up two functions
DRY up two functions

yangfan876/sarama,winlinvip/sarama,betable/sarama,uovobw/sarama,kraveio/sarama,LastManStanding/sarama,Neuw84/sarama,VividCortex/sarama,DataDog/sarama,Neuw84/sarama,raisemarketplace/sarama,aybabtme/sarama,winlinvip/sarama,HelixEducation/sarama,remerge/sarama,kmiku7/sarama,jepst/sarama,vrischmann/sarama,jimmykuo/sarama,LastManStanding/sarama,vrischmann/sarama,jepst/sarama,aybabtme/sarama,kmiku7/sarama,mailgun/sarama,HelixEducation/sarama,pronix/sarama,crast/sarama,gyroscope-innovations/legacy_sarama,VividCortex/sarama,yangfan876/sarama,raisemarketplace/sarama,mailgun/sarama,Shopify/sarama,cep21/sarama,rafrombrc/sarama,scalingdata/sarama,jimmykuo/sarama,remerge/sarama,rafrombrc/sarama,cep21/sarama,DataDog/sarama,uovobw/sarama,gyroscope-innovations/legacy_sarama,pronix/sarama,scalingdata/sarama,betable/sarama,kraveio/sarama,Shopify/sarama,crast/sarama