public int RegisterNewClient(ClientRegistrationInfo args) { var entityToAdd = (new ClientEntity() { RegistationDateTime = DateTime.Now, Name = args.Name, Phone = args.Phone, Balance = 0M }); if (clientTableRepository.Contains(entityToAdd)) { throw new ArgumentException("This client has been already registered"); } clientTableRepository.Add(entityToAdd); clientTableRepository.SaveChanges(); return(entityToAdd.Id); }