public async Task <BusinessUnitDTO> CreateBusinnesUnitAsync(string brandName, string address, string phoneNumber, string email, string information, int businessUnitCategoryId, int townId, string picture) { var checkBrandNameIfExists = await this.context.BusinessUnits .FirstOrDefaultAsync(n => n.Name == brandName); if (checkBrandNameIfExists != null) { throw new AlreadyExistsException(ServicesConstants.BusinessUnitNameAlreadyExists); } businessValidator.IsNameInRange(brandName); businessValidator.IsAddressInRange(address); businessValidator.IsEmailValid(email); businessValidator.IsPhoneNumberValid(phoneNumber); businessValidator.IsDescriptionInRange(information); var businessUnit = new BusinessUnit() { Name = brandName, Address = address, PhoneNumber = phoneNumber, Email = email, Information = information, BusinessUnitCategoryId = businessUnitCategoryId, TownId = townId, Picture = picture }; await this.context.BusinessUnits.AddAsync(businessUnit); await this.context.SaveChangesAsync(); var result = await this.context.BusinessUnits .Include(buc => buc.BusinessUnitCategory) .Include(t => t.Town) .FirstOrDefaultAsync(x => x.Id == businessUnit.Id); return(result.ToDTO()); }