class EC2RaiderImpl implements EC2Raider {

    @Override
    public void detachSecurityGroup(String instanceId, String securityGroup) {

        if (instanceId.isEmpty() || instanceId == null) {
            throw new InvalidInputDataException("Empty/Null instanceId provided in request");
        } else if (securityGroup.isEmpty() || securityGroup == null) {
            throw new InvalidInputDataException("Empty/Null securityGroup provided in request");
        }

        List<String> securityGroups = this.getSecurityGroups(instanceId);

        if (securityGroups != null && securityGroups.contains(securityGroup)) {
            securityGroups.remove(securityGroup);
            ec2Delegator.getEc2().modifyInstanceAttribute(new ModifyInstanceAttributeRequest().withInstanceId(instanceId).withGroups(securityGroups));

        } else {
            throw new InvalidInputDataException("Invalid SecurityGroup: " + securityGroup + " provided in request");
        }

    }

    public  EC2RaiderImpl();

}