refactored update action in memberships controller