function getTokenAmount(uint _weiAmount, bool _isPresale) external returns (uint) {
        uint tokenAmount = _weiAmount.div(rate) * 1 ether;
        uint bonusPercent;
        if (_isPresale) {
            bonusPercent = getPresaleBonus(_weiAmount);
        } else {
            bonusPercent = getPublicSaleBonus();
        }
        if (bonusPercent == 0) {
            return tokenAmount;
        }
        return tokenAmount.add(tokenAmount.mul(bonusPercent).div(1000));
    }