internal static IResult <Expression <Func <InventoryShipmentOrder, bool> > > ParseToPredicate(this FilterInterWarehouseOrderParameters parameters)
        {
            var predicate = InventoryShipmentOrderPredicates.ByOrderType(InventoryShipmentOrderTypeEnum.InterWarehouseOrder);

            if (parameters != null)
            {
                if (parameters.OriginFacilityKey != null)
                {
                    var facilityKey = KeyParserHelper.ParseResult <IFacilityKey>(parameters.OriginFacilityKey);
                    if (!facilityKey.Success)
                    {
                        return(facilityKey.ConvertTo <Expression <Func <InventoryShipmentOrder, bool> > >());
                    }

                    predicate = predicate.And(InventoryShipmentOrderPredicates.ByOriginFacility(new FacilityKey(facilityKey.ResultingObject)).ExpandAll());
                }

                if (parameters.DestinationFacilityKey != null)
                {
                    var facilityKey = KeyParserHelper.ParseResult <IFacilityKey>(parameters.DestinationFacilityKey);
                    if (!facilityKey.Success)
                    {
                        return(facilityKey.ConvertTo <Expression <Func <InventoryShipmentOrder, bool> > >());
                    }

                    predicate = predicate.And(InventoryShipmentOrderPredicates.ByDestinationFacility(new FacilityKey(facilityKey.ResultingObject)).ExpandAll());
                }
            }

            return(new SuccessResult <Expression <Func <InventoryShipmentOrder, bool> > >(predicate));
        }