public ActionResult RegisterBusiness([Bind(Exclude = "Logo")] BusinessFormViewModel businessFormViewModel)
        {
            if (!ModelState.IsValid)
            {
                businessFormViewModel.Categories = unitOfWork.Categories.GetCategories();
                businessFormViewModel.Locations  = unitOfWork.Locations.GetLocations();
                businessFormViewModel.Areas      = unitOfWork.Areas.GetAreas();
                businessFormViewModel.Heading    = "Register business";
                return(View("RegisterBusiness", businessFormViewModel));
            }


            byte[] imageData = null;
            if (Request.Files.Count > 0)
            {
                HttpPostedFileBase poImgFile = Request.Files["Logo"];

                using (var binary = new BinaryReader(poImgFile.InputStream))
                {
                    imageData = binary.ReadBytes(poImgFile.ContentLength);
                }
            }

            string userId = User.Identity.GetUserId();


            CheckUpdateCategoryLocationArea(businessFormViewModel);
            businessFormViewModel.Areas      = unitOfWork.Areas.GetAreas();
            businessFormViewModel.Locations  = unitOfWork.Locations.GetLocations();
            businessFormViewModel.Categories = unitOfWork.Categories.GetCategories();

            var restaurant = Restaurant.RegisterARestaurantWithOwnership(businessFormViewModel, imageData);



            unitOfWork.Businesses.AddRestaurant(restaurant);

            unitOfWork.Complete();

            unitOfWork.RestaurantOwnerships.AddRestaurantOwnership(RestaurantOwnership.CeateRestaurantOwnership(restaurant, userId));

            unitOfWork.EventPlaces.AddEventPlace(EventPlace.CreateEventPlace(restaurant));

            unitOfWork.Complete();

            return(RedirectToAction("MyBusinesses", "Restaurant"));
        }
 public void AddRestaurantOwnership(RestaurantOwnership restaurantOwnership)
 {
     _context.RestaurantOwnerships.Add(restaurantOwnership);
 }