public byte[] GetDeliveryPDF(int orderId, bool ifSendEmail)
        {
            if (UserHelper.IsAuthorize(new List <int> {
                (int)UserType.SuperAdmin, (int)UserType.Admin
            }))
            {
                try
                {
                    Delivery deliveryToPdf = _context.Deliveries.FirstOrDefault(d => d.Order_Id == orderId);
                    Order    orderToPdf    = _context.Orders.FirstOrDefault(o => o.Id == deliveryToPdf.Order_Id && o.Deleted_At == null);
                    List <Orders_Positions> orderPositionsToPdf = _context.Orders_Positions.Where(o => o.Order_id == deliveryToPdf.Order_Id && o.Deleted_At == null).ToList();
                    User   userCreator = _context.Users.FirstOrDefault(u => u.Id == deliveryToPdf.Creator_Id && u.Deleted_at == null);
                    string creatorName = "";
                    if (userCreator != null)
                    {
                        creatorName = userCreator.Name + " " + userCreator.Surname;//Do zmiany na imie i nazwisko
                    }

                    byte[] result = _pdfManager.GenerateDeliveryPDF(deliveryToPdf, orderToPdf, orderPositionsToPdf, creatorName);
                    if (ifSendEmail)
                    {
                        _pdfManager.SendEmail("Delivery_" + deliveryToPdf.Delivery_Number, result);
                    }
                    // Zmienić creatora na creatora delivery czyli przyjmujacego zamowienie - trzeb dodać w bazie
                    return(result);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.ToString());
                }
            }

            else
            {
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "User don't have acces to this method"));
            }
        }