public static MailViewModel GetByOrderId(IUnitOfWork db,
                                                 IWeightService weightService,
                                                 string id)
        {
            var order = db.Orders.GetMailDTOByOrderId(weightService, id);

            if (order == null)
            {
                return(new MailViewModel
                {
                    ToAddress = new AddressViewModel
                    {
                        Address1 = String.Empty,
                        Address2 = String.Empty,
                        FullName = String.Empty,
                        City = String.Empty,
                        USAState = String.Empty,
                        NonUSAState = String.Empty,
                        Country = String.Empty,
                        Zip = String.Empty,
                        Phone = String.Empty,
                        Email = String.Empty,
                        ShipDate = null
                    },
                    Items = new List <MailItemViewModel>(),
                    MarketplaceCode = 1,
                    Notes = String.Empty,
                    OrderStatus = String.Empty,
                    OrderID = String.Empty,
                    OrderEntityId = null,
                    IsPrime = false,

                    ShipmentProviderId = (int)ShipmentProviderType.Stamps,
                    HasBatchLabels = false,
                    HasMailLabels = false,

                    WeightLb = null,
                    WeightOz = null,
                });
            }
            else
            {
                return(new MailViewModel
                {
                    ToAddress = new AddressViewModel
                    {
                        Address1 = order.ToAddress.FinalAddress1,
                        Address2 = order.ToAddress.FinalAddress2,
                        FullName = order.ToAddress.FinalFullName,
                        City = order.ToAddress.FinalCity,
                        USAState = StringHelper.ToUpper(order.ToAddress.FinalState),
                        NonUSAState = StringHelper.ToUpper(order.ToAddress.FinalState),
                        Country = order.ToAddress.FinalCountry,
                        Zip = order.ToAddress.FinalZip,
                        ZipAddon = order.ToAddress.FinalZipAddon,
                        Phone = order.ToAddress.FinalPhone,
                        Email = order.ToAddress.BuyerEmail,
                        ShipDate = order.ToAddress.ShipDate
                    },
                    MarketplaceCode = 1,
                    Notes = "",

                    Market = order.Market,
                    MarketplaceId = order.MarketplaceId,

                    OrderStatus = order.OrderStatus,
                    OrderEntityId = order.OrderEntityId,
                    OrderID = order.OrderId,
                    IsPrime = order.OrderType == (int)OrderTypeEnum.Prime,
                    RequireAmazonProvider = ShippingUtils.RequireAmazonProvider(order.OrderType,
                                                                                order.Market,
                                                                                order.ToAddress.FinalCountry,
                                                                                order.SourceShippingService),

                    ShipmentProviderId = order.ShipmentProviderType,
                    HasBatchLabels = order.Labels.Any(l => l.LabelFromType == (int)LabelFromType.Batch),
                    HasMailLabels = order.Labels.Any(l => l.LabelFromType == (int)LabelFromType.Mail),

                    WeightLb = order.WeightLb,
                    WeightOz = order.WeightOz,

                    TotalPrice = order.TotalPrice,
                    TotalPriceCurrency = order.TotalPriceCurrency,

                    Items = order.Items.Select(i => new MailItemViewModel(i)).ToList(),

                    IsInsured = order.IsInsured
                });
            }
        }