public List <MessageString> Validate(IUnitOfWork db,
                                             ILogService log,
                                             DateTime when)
        {
            var messages = new List <MessageString>();

            if (IncomeType == (int)BoxIncomePackType.PPK)
            {
                var existBoxes = db.SealedBoxes.GetAllAsDto().Where(b => b.StyleId == StyleId &&
                                                                    b.BoxQuantity == BoxQuantity)
                                 .ToList();

                foreach (var existBox in existBoxes)
                {
                    var boxItems = db.SealedBoxItems.GetByBoxIdAsDto(existBox.Id);
                    var isEqual  = Sizes.Count(s => s.Breakdown > 0) == boxItems.Count;
                    foreach (var boxItem in boxItems)
                    {
                        var size = Sizes.FirstOrDefault(s => s.Id == boxItem.StyleItemId);
                        if (size == null || size.Breakdown != boxItem.BreakDown)
                        {
                            isEqual = false;
                        }
                    }

                    if (isEqual)
                    {
                        messages.Add(new MessageString()
                        {
                            Message = "A similar boxes already exist (created on " + DateHelper.ToDateString(existBox.CreateDate) + "). Are you sure you would like to create them?",
                            Status  = MessageStatus.Info,
                        });

                        return(messages);
                    }
                }
            }

            if (IncomeType == (int)BoxIncomePackType.PolyBagged)
            {
                foreach (var size in Sizes.Where(si => si.Quantity > 0))
                {
                    var totalQuantity = UnitsPerBox * size.Quantity;

                    var existBoxes = db.SealedBoxes.GetAllAsDto().Where(b => b.StyleId == StyleId &&
                                                                        b.BoxQuantity == size.Quantity)
                                     .ToList();

                    foreach (var existBox in existBoxes)
                    {
                        var boxItems           = db.SealedBoxItems.GetByBoxIdAsDto(existBox.Id);
                        var existTotalQuantity = boxItems.Sum(bi => bi.BreakDown) * existBox.BoxQuantity;
                        if (existTotalQuantity == totalQuantity && boxItems.Count == 1)
                        {
                            messages.Add(new MessageString()
                            {
                                Message = "A similar boxes already exist (created on " + DateHelper.ToDateString(existBox.CreateDate) + "). Are you sure you would like to create them?",
                                Status  = MessageStatus.Info,
                            });

                            return(messages);
                        }
                    }
                }
            }

            if (IncomeType == (int)BoxIncomePackType.Other)
            {
                var existBoxes = db.OpenBoxes.GetAllAsDto().Where(b => b.StyleId == StyleId &&
                                                                  b.BoxQuantity == 1)
                                 .ToList();

                foreach (var existBox in existBoxes)
                {
                    var boxItems = db.OpenBoxItems.GetByBoxIdAsDto(existBox.Id);

                    var isEqual = Sizes.Count(s => s.Quantity > 0) == boxItems.Count;
                    foreach (var boxItem in boxItems)
                    {
                        var size = Sizes.FirstOrDefault(s => s.Id == boxItem.StyleItemId);
                        if (size == null || size.Quantity != boxItem.Quantity)
                        {
                            isEqual = false;
                        }
                    }

                    if (isEqual)
                    {
                        messages.Add(new MessageString()
                        {
                            Message = "A similar box already exists (created on " +
                                      DateHelper.ToDateString(existBox.CreateDate) + "). Are you sure you would like to create one?",
                            Status = MessageStatus.Info,
                        });

                        return(messages);
                    }
                }
            }

            return(messages);
        }