private void AddPropertyTypes()
        {
            if (_context.PropertyTypes.Any() == false)
            {
                var propertyTypes = new List <string>()
                {
                    "House", "Appartment", "Unit", "Villa", "Townhouse", "Acerage"
                };

                propertyTypes.ForEach(c => _context.Add(new PropertyType
                {
                    Name = c
                }));

                _context.SaveChanges();
            }
        }
        public async Task <bool> CreateUserSeller(string userNmae, string firstName, string lastName, string email, string phoneNumber, string userId)
        {
            var userSeller = new UserSeller
            {
                Id          = Guid.NewGuid().ToString(),
                UserName    = userNmae,
                FirstName   = firstName,
                LastName    = lastName,
                Email       = email,
                PhoneNumber = phoneNumber,
                UserId      = userId
            };

            context.Add(userSeller);
            int result = await context.SaveChangesAsync();

            if (result == 0)
            {
                return(false);
            }
            return(true);
        }
        public async Task <bool> Create(DealCreateRequestModel model)
        {
            var deal = new Deal
            {
                Id        = Guid.NewGuid().ToString(),
                Title     = model.Title,
                BuyerId   = model.BuyerId,
                CreatedOn = DateTime.UtcNow,
                IsDeleted = false,
                ListingId = model.ListingId,
                Price     = model.Price,
                SellerId  = model.SellerId
            };

            var listing = await this.context.Listings.FirstOrDefaultAsync(x => x.Id == model.ListingId);

            listing.IsDeal = true;

            context.Add(deal);
            // context.Listings.Update(listing);

            //var result = await context.SaveChangesAsync();

            var messageData = new ListingAcceptedMessage()
            {
                ListingId = model.OfferId
            };

            var messageId = Guid.NewGuid().ToString();
            var message   = new Message(messageData, messageId);

            await this.Save(listing, message);

            await this.publisher.Publish(messageData);

            return(true);
        }