public ActionResult Create(CompanyModel model)
        {
            try
            {
                byte[] tempImage;

                HttpPostedFileBase file = Request.Files["CompanyImage"];
                if(file != null)
                {
                    Image img = Image.FromStream(file.InputStream);

                    int width = img.Width;
                    int height = img.Height;

                    if (width > IMAGE_MAX_WIDTH)
                    {
                        width = IMAGE_MAX_WIDTH;
                        height = (int)((float)height * width / img.Width);
                    }
                    img = img.GetThumbnailImage(width, height, null, IntPtr.Zero);

                    MemoryStream ms = new MemoryStream();
                    img.Save(ms, ImageFormat.Png);
                    tempImage = ms.ToArray();
                }
                else
                {
                    tempImage = new byte[]{};
                }

                List<int> tags = new List<int>();
                string[] tagsCheckBoxes;
                if ((tagsCheckBoxes = Request.Form.GetValues("tags")) != null)

                    foreach (var tag in tagsCheckBoxes)
                    {
                        int tagId;
                        int.TryParse(tag, out tagId);
                        tags.Add(tagId);
                    }

                businessLayer.CreateCompany(model.Name, model.Url, tempImage, model.Email, model.Password, model.Address1, model.Address2,
                                             model.PostalCode, model.City, model.CountryId, tags);

                return RedirectToAction("MyAccount", "Home");
            }
            catch
            {
                ViewBag.ListCountry = businessLayer.ListAllCountries();
                return View();
            }
        }
        public ActionResult Edit(CompanyModel model)
        {
            try
            {
                byte[] tempImage = null;

                HttpPostedFileBase file = Request.Files["CompanyImage"];
                if(file != null)
                {
                    Image img = Image.FromStream(file.InputStream);

                    int width = img.Width;
                    int height = img.Height;

                    if (width > IMAGE_MAX_WIDTH)
                    {
                        width = IMAGE_MAX_WIDTH;
                        height = (int)((float)height * width / img.Width);
                    }
                    img = img.GetThumbnailImage(width, height, null, IntPtr.Zero);

                    MemoryStream ms = new MemoryStream();
                    img.Save(ms, ImageFormat.Png);
                    tempImage = ms.ToArray();
                }

                List<int> tags = new List<int>();
                string[] tagsCheckBoxes;
                if ((tagsCheckBoxes = Request.Form.GetValues("tags")) != null)

                    foreach (var tag in tagsCheckBoxes)
                    {
                        int tagId;
                        int.TryParse(tag, out tagId);
                        tags.Add(tagId);
                    }

                string userEmail = User.Identity.Name;

                int userId = businessLayer.GetProfile(userEmail).Id;

                businessLayer.EditCompany(userId, model.Name, model.Url, tempImage, model.Email, model.Address1, model.Address2,
                                             model.PostalCode, model.City, model.CountryId, tags);

                return RedirectToAction("Details");
            }
            catch(Exception e)
            {
                return View();
            }
        }