public bool RemoveContract(int contractNumber)
        {
            var temp = (from contract in Contracts.Elements()
                        where Convert.ToInt32(contract.Element("ContractNumber").Value) == contractNumber
                        select contract).FirstOrDefault();

            if (temp == null)
            {
                throw new Exception("No contract with the same contract number...");
            }
            temp.Remove();
            SaveContracts();
            return(true);
        }
        public void UpdateContract(Contract contract)
        {
            XElement updateContract = (from cont in Contracts.Elements()
                                       where Convert.ToInt32(cont.Element("ContractNumber").Value) == contract.ContractNumber
                                       select cont).FirstOrDefault();

            if (updateContract == null)
            {
                throw new Exception("No child with the same id...");
            }
            foreach (var xElement in contract.toXML().Elements())
            {
                updateContract.Element(xElement.Name).Value = xElement.Value;
            }
            SaveContracts();
        }
        public bool RemoveNanny(int id)
        {
            if (Contracts.Elements().Any(contract => Convert.ToInt32(contract.Element("NannyID")) == id))
            {
                throw new Exception("Nanny still has existing contracts...");
            }
            var temp = (from nanny in Nannies.Elements()
                        where Convert.ToInt32(nanny.Element("ID").Value) == id
                        select nanny).FirstOrDefault();

            if (temp == null)
            {
                throw new Exception("No nanny with same id was found... ");
            }
            temp.Remove();
            SaveNannies();
            return(true);
        }
 public Contract GetContract(int contractNumber)
 {
     return(((from contract in Contracts.Elements()
              where Convert.ToInt32(contract.Element("ContractNumber").Value) == contractNumber
              select contract).FirstOrDefault()).ToContract());
 }