Added isAmountValidForMargin method.