function createRequest(
        address     _creator,
        address[]   _payees,
        int256[]    _expectedAmounts,
        address     _payer,
        string      _data)
        external
        whenNotPaused 
        returns (bytes32 requestId) 
    {
        
        require(_creator != 0, "creator should not be 0"); 
        
        require(isTrustedContract(msg.sender), "caller should be a trusted contract"); 

        
        requestId = generateRequestId();

        address mainPayee;
        int256 mainExpectedAmount;
        
        if (_payees.length!=0) {
            mainPayee = _payees[0];
            mainExpectedAmount = _expectedAmounts[0];
        }

        
        requests[requestId] = Request(
            _payer,
            msg.sender,
            State.Created,
            Payee(
                mainPayee,
                mainExpectedAmount,
                0
            )
        );

        
        emit Created(
            requestId,
            mainPayee,
            _payer,
            _creator,
            _data
        );
        
        
        initSubPayees(requestId, _payees, _expectedAmounts);

        return requestId;
    }