Clean code of buy controller