Move account handling logic to separate class