public void UpdateCompany()
        {
            string companyId;
            string employeeId;

            using (var session = Store.OpenSession())
            {
                var employee = new Employee
                {
                    HourlyRate = 30,
                    JoinAt = DateTime.Now,
                    Name = "Raven DBBBB",
                    Specialities = new[] { "NoSQL" }
                };

                session.Store(employee);
                employeeId = employee.Id;

                var company = new Company
                                  {
                                      Country = "Kuwait",
                                      Employees = new List<Employee>
                                                      {
                                                          employee
                                                      },
                                      Name = "CompO1"
                                  };

                session.Store(company);
                companyId = company.Id;

                session.SaveChanges();
            }

            using (var session = Store.OpenSession())
            {
                var employee = session.Load<Employee>(employeeId);
                var company = session.Load<Company>(companyId);

                employee.Name = "RavenDB";
                company.Name = "IT Info Company";

                //this will save all changes automatically
                // in a single request
                session.SaveChanges();
            }

            using (var session = Store.OpenSession())
            {
                var emp = session.Load<Employee>(employeeId);
                var comp = session.Load<Company>(companyId);
                Assert.Equal("RavenDB", emp.Name);
                Assert.Equal("IT Info Company", comp.Name);
            }
        }
        public void CreateNewCompany()
        {
            using (var session = Store.OpenSession())
            {
                var employee = new Employee
                {
                    HourlyRate = 50,
                    JoinAt = DateTime.Today.Date,
                    Name = "John Smith",
                    Specialities = new[] { "C#" }
                };

                var employee2 = new Employee
                {
                    HourlyRate = 50,
                    JoinAt = DateTime.Today.Date,
                    Name = "Smith Lee",
                    Specialities = new[] { "RavenDB", "SQL" }
                };

                var company = new Company
                                  {
                                      Country = "United Kingdom",
                                      Name = "ItsMeRaven",
                                      Employees = new List<Employee>
                                                      {
                                                          employee,
                                                          employee2
                                                      }
                                  };

                // serializing the whole document into one big JSON blob
                session.Store(company);
                Assert.NotNull(company.Id);

                // nothing sent to the server yet
                session.SaveChanges();
            }
        }