public JsonResult GetTransitAspectChartObjects(
            int id,
            int firstChartId,
            int secondChartId,
            bool draconic,
            bool arabic,
            bool asteroids,
            bool stars,
            byte houseSystemId)
        {
            if (id <= 0)
            {
                return this.Json(null, JsonRequestBehavior.AllowGet);
            }

            var chartCon = new EnteredChartsController();

            var firstChartObject = this.db.ChartObjects.Find(id);

            var thisChart =
                this.db.ChartObjects.Where(x => x.EnteredChartID == secondChartId)
                    .Where(
                        objects =>
                        (!objects.CelestialObject.Draconic)
                        && (objects.CelestialObject.CelestialObjectTypeId
                            != (byte)ChartObject.ObjectTypes.AngleHouseCusp)
                        && (objects.CelestialObject.CelestialObjectTypeId != (byte)ChartObject.ObjectTypes.ArabicPart)
                        && ((!asteroids
                             && objects.CelestialObject.CelestialObjectTypeId != (byte)ChartObject.ObjectTypes.Asteroid)
                            || asteroids)
                        && ((!stars
                             && objects.CelestialObject.CelestialObjectTypeId != (byte)ChartObject.ObjectTypes.FixedStar)
                            || stars))
                    .ToList()
                    .Union(chartCon.GetAngleChartObjects(secondChartId))
                    .Union(chartCon.GetArabicPartChartObjects(secondChartId, houseSystemId, arabic))
                    .Union(
                        chartCon.GetDraconicChartObjects(
                            secondChartId,
                            draconic,
                            arabic,
                            asteroids,
                            houseSystemId))
                    .OrderBy(x => x.CalculatedCoordinate);

            var aspectList = this.db.Aspects.OrderBy(a => a.AspectId).ToList();

            var aspectObjectLists = chartCon.GetAspectObjectLists(thisChart, firstChartObject, secondChartId, houseSystemId);

            var thisList = new List<object>();

            for (var i = 0; i < aspectList.Count; i++)
            {
                thisList.Add(
                    new { aspectList[i].AspectId, aspectList[i].AspectName, aspectList[i].HtmlTextCssClass, aspectList = aspectObjectLists[i] });
            }

            return this.Json(thisList, JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetSynastryAspectChartObjectsForDraconicObject(
            int firstChartId,
            int secondChartId,
            [CanBeNull] string draconicName,
            [CanBeNull] string draconicCoordinates,
            bool draconic,
            bool arabic,
            bool asteroids,
            bool stars,
            byte houseSystemId)
        {
            if (string.IsNullOrEmpty(draconicName) || string.IsNullOrEmpty(draconicCoordinates) || firstChartId <= 0 || secondChartId <= 0)
            {
                return this.Json(null, JsonRequestBehavior.AllowGet);
            }

            var chartCon = new EnteredChartsController();

            var draconicObjects = chartCon.GetDraconicChartObjects(firstChartId, draconic, arabic, asteroids, houseSystemId);

            if (draconicObjects.Count == 0)
            {
                return this.Json(null, JsonRequestBehavior.AllowGet);
            }

            var secondDraconicObjects = chartCon.GetDraconicChartObjects(secondChartId, draconic, arabic, asteroids, houseSystemId);

            var thisObject = draconicObjects.FirstOrDefault(
                ap => ap.CelestialObject.CelestialObjectName == draconicName);

            var thisChart =
                this.db.ChartObjects.Where(x => x.EnteredChartID == secondChartId)
                    .Where(
                        objects =>
                        (!objects.CelestialObject.Draconic)
                        && (objects.CelestialObject.CelestialObjectTypeId
                            != (byte)ChartObject.ObjectTypes.AngleHouseCusp)
                        && (objects.CelestialObject.CelestialObjectTypeId != (byte)ChartObject.ObjectTypes.ArabicPart)
                        && ((!asteroids
                             && objects.CelestialObject.CelestialObjectTypeId != (byte)ChartObject.ObjectTypes.Asteroid)
                            || asteroids)
                        && ((!stars
                             && objects.CelestialObject.CelestialObjectTypeId != (byte)ChartObject.ObjectTypes.FixedStar)
                            || stars))
                    .ToList()
                    .Union(chartCon.GetAngleChartObjects(secondChartId))
                    .Union(chartCon.GetArabicPartChartObjects(secondChartId, houseSystemId, arabic))
                    .Union(secondDraconicObjects)
                    .OrderBy(x => x.CalculatedCoordinate);

            var aspectList = this.db.Aspects.OrderBy(a => a.AspectId).ToList();

            var aspectObjectLists = chartCon.GetAspectObjectLists(thisChart, thisObject, secondChartId, houseSystemId);

            var thisList = new List<object>();

            for (var i = 0; i < aspectList.Count; i++)
            {
                thisList.Add(
                    new { aspectList[i].AspectId, aspectList[i].AspectName, aspectList[i].HtmlTextCssClass, aspectList = aspectObjectLists[i] });
            }

            return this.Json(thisList, JsonRequestBehavior.AllowGet);
        }