refactor creation of membership_payment records into shared function
use try catch rather than passing errors as a reference
refactor out createOrRenewMembership function
share create membership function & move compiling errors into a separate function